diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5145235c..4c7c3dc7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,9 +13,8 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: | - 6.0.X - 7.0.X 8.0.X + 9.0.X - name: Install dependencies run: dotnet msbuild -target:restore .\build.proj - name: Build diff --git a/build.proj b/build.proj index b75637cb..00f12435 100644 --- a/build.proj +++ b/build.proj @@ -21,12 +21,12 @@ - - + + - + @@ -35,87 +35,38 @@ source\fitSharp\bin\release\net48\fitSharp.dll; source\fit\bin\release\net48\fit.dll; source\Runner\bin\release\net48\Runner.exe; - source\RunnerW\bin\release\net48\RunnerW.exe; - source\dbfit\bin\release\net48\dbfit.dll; - source\dbfitMySql\bin\release\net48\dbfit.mysql.dll; - source\dbfitOracle\bin\release\net48\dbfit.oracle.dll; - source\dbfitSqlServer\bin\release\net48\dbfit.sqlserver.dll; - source\dbfitSybase\bin\release\net48\dbfit.sybase.dll;"/> - - - - + source\RunnerW\bin\release\net48\RunnerW.exe"/> + source\Runner\bin\release\net8.0\Runner.runtimeconfig.json"/> + source\RunnerW\bin\release\net8.0-windows\RunnerW.runtimeconfig.json"/> + + - - - - + + diff --git a/document/fitSharp/Fit/CompareFloatingPoint.html b/document/fitSharp/Fit/CompareFloatingPoint.html index 9f62bf85..2364d304 100644 --- a/document/fitSharp/Fit/CompareFloatingPoint.html +++ b/document/fitSharp/Fit/CompareFloatingPoint.html @@ -1,6 +1,6 @@ @@ -26,6 +26,7 @@ 6abandon story test 7abandon story test 8abandon story test +9abandon story test
diff --git a/fitSharp.sln b/fitSharp.sln index 16a4e3fa..2ecc15b4 100644 --- a/fitSharp.sln +++ b/fitSharp.sln @@ -17,18 +17,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "fitTest", "source\fitTest\f EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Runner", "source\Runner\Runner.csproj", "{2EB7CA6D-7373-48E5-97C0-D98E1560E161}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dbfit", "source\dbfit\dbfit.csproj", "{6F72A0B4-EAB2-410A-945D-4C4D04B18893}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dbfitMySql", "source\dbfitMySql\dbfitMySql.csproj", "{0E54698B-0BF7-4413-9E4C-C807E346CD11}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dbfitOracle", "source\dbfitOracle\dbfitOracle.csproj", "{F38C6772-3B92-4E10-9ED4-D37BE35D2303}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dbfitSqlServer", "source\dbfitSqlServer\dbfitSqlServer.csproj", "{CF0CAD84-0102-4C7C-BA8C-572111FF6899}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dbfitSybase", "source\dbfitSybase\dbfitSybase.csproj", "{94F5FD4F-C6C9-4D60-94BF-13974F780A3E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dbfitTest", "source\dbfitTest\dbfitTest.csproj", "{383E3568-AEEE-4F95-8D87-355D891DB36F}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RunnerW", "source\RunnerW\RunnerW.csproj", "{73A6C8F9-FB51-4D17-9BED-4BE0785CD5B0}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestTarget2", "source\TestTarget2\TestTarget2.csproj", "{538B8011-B247-46EC-A9AB-29BC5262A543}" @@ -69,30 +57,6 @@ Global {2EB7CA6D-7373-48E5-97C0-D98E1560E161}.Debug|Any CPU.Build.0 = Debug|Any CPU {2EB7CA6D-7373-48E5-97C0-D98E1560E161}.Release|Any CPU.ActiveCfg = Release|Any CPU {2EB7CA6D-7373-48E5-97C0-D98E1560E161}.Release|Any CPU.Build.0 = Release|Any CPU - {6F72A0B4-EAB2-410A-945D-4C4D04B18893}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6F72A0B4-EAB2-410A-945D-4C4D04B18893}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6F72A0B4-EAB2-410A-945D-4C4D04B18893}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6F72A0B4-EAB2-410A-945D-4C4D04B18893}.Release|Any CPU.Build.0 = Release|Any CPU - {0E54698B-0BF7-4413-9E4C-C807E346CD11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0E54698B-0BF7-4413-9E4C-C807E346CD11}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0E54698B-0BF7-4413-9E4C-C807E346CD11}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0E54698B-0BF7-4413-9E4C-C807E346CD11}.Release|Any CPU.Build.0 = Release|Any CPU - {F38C6772-3B92-4E10-9ED4-D37BE35D2303}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F38C6772-3B92-4E10-9ED4-D37BE35D2303}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F38C6772-3B92-4E10-9ED4-D37BE35D2303}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F38C6772-3B92-4E10-9ED4-D37BE35D2303}.Release|Any CPU.Build.0 = Release|Any CPU - {CF0CAD84-0102-4C7C-BA8C-572111FF6899}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CF0CAD84-0102-4C7C-BA8C-572111FF6899}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CF0CAD84-0102-4C7C-BA8C-572111FF6899}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CF0CAD84-0102-4C7C-BA8C-572111FF6899}.Release|Any CPU.Build.0 = Release|Any CPU - {94F5FD4F-C6C9-4D60-94BF-13974F780A3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {94F5FD4F-C6C9-4D60-94BF-13974F780A3E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {94F5FD4F-C6C9-4D60-94BF-13974F780A3E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {94F5FD4F-C6C9-4D60-94BF-13974F780A3E}.Release|Any CPU.Build.0 = Release|Any CPU - {383E3568-AEEE-4F95-8D87-355D891DB36F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {383E3568-AEEE-4F95-8D87-355D891DB36F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {383E3568-AEEE-4F95-8D87-355D891DB36F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {383E3568-AEEE-4F95-8D87-355D891DB36F}.Release|Any CPU.Build.0 = Release|Any CPU {73A6C8F9-FB51-4D17-9BED-4BE0785CD5B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {73A6C8F9-FB51-4D17-9BED-4BE0785CD5B0}.Debug|Any CPU.Build.0 = Debug|Any CPU {73A6C8F9-FB51-4D17-9BED-4BE0785CD5B0}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/nuget/FitSharp.nuspec b/nuget/FitSharp.nuspec index 75f320cd..693b5c6d 100644 --- a/nuget/FitSharp.nuspec +++ b/nuget/FitSharp.nuspec @@ -8,11 +8,11 @@ mikestockdalehttp://fitsharp.github.io/false - fitSharp is a set of open-source functional testing tools for .NET, inspired by the Framework for Integrated Test + fitSharp is a set of open-source functional testing tools for .NET, inspired by the Framework for Integrated Test. It can be used in combination with FitNesse.Copyright © 2022 Syterra Software Inc. All rights reserved.See https://fitsharp.github.io/FitSharp/ReleaseInformation.htmllicense\license.txt - fit fitnesse testing + fit fitnesse testing dotnet diff --git a/source/Runner/Runner.csproj b/source/Runner/Runner.csproj index 8bc4e557..6b3d81ac 100644 --- a/source/Runner/Runner.csproj +++ b/source/Runner/Runner.csproj @@ -1,7 +1,7 @@  Exe - net48;net6.0;net6.0-windows;net7.0;net7.0-windows;net8.0;net8.0-windows + net48;net8.0;net8.0-windows;net9.0;net9.0-windows fitSharp.Runner false false diff --git a/source/Runner/RunnerL.csproj b/source/Runner/RunnerL.csproj index a5cd3c2e..f53e9d5a 100644 --- a/source/Runner/RunnerL.csproj +++ b/source/Runner/RunnerL.csproj @@ -1,7 +1,7 @@  Exe - net6.0 + net8.0 fitSharp.Runner false false diff --git a/source/RunnerW/RunnerW.csproj b/source/RunnerW/RunnerW.csproj index 2a868bc3..8b120021 100644 --- a/source/RunnerW/RunnerW.csproj +++ b/source/RunnerW/RunnerW.csproj @@ -2,7 +2,7 @@ Exe - net48;net6.0-windows;net7.0-windows;net8.0-windows + net48;net8.0-windows;net9.0-windows true false false diff --git a/source/Samples/Samples.csproj b/source/Samples/Samples.csproj index 682b5337..e502f6fb 100644 --- a/source/Samples/Samples.csproj +++ b/source/Samples/Samples.csproj @@ -1,6 +1,6 @@  - net48;net6.0;net6.0-windows;net7.0;net7.0-windows;net8.0;net8.0-windows + net48;net8.0;net8.0-windows;net9.0;net9.0-windows fitSharp.Samples false false diff --git a/source/Samples/SamplesL.csproj b/source/Samples/SamplesL.csproj index a239bd1e..5d200ce4 100644 --- a/source/Samples/SamplesL.csproj +++ b/source/Samples/SamplesL.csproj @@ -1,6 +1,6 @@  - net6.0 + net8.0 fitSharp.Samples false false diff --git a/source/StoryTest/StoryTest.cs b/source/StoryTest/StoryTest.cs index 8fe3ea1c..465cfb08 100644 --- a/source/StoryTest/StoryTest.cs +++ b/source/StoryTest/StoryTest.cs @@ -9,6 +9,7 @@ using fitSharp.Machine.Application; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.StoryTest { [TestFixture] @@ -32,7 +33,7 @@ public void Run() { var config = Path.Combine( AppDomain.CurrentDomain.BaseDirectory.Before(new[] {"/build/".AsPath(), "/source/".AsPath()}), "storytest.config." + TargetFramework.FileExtension + ".xml"); - Assert.AreEqual(0, Shell.Run(new [] {"-c", config})); + ClassicAssert.AreEqual(0, Shell.Run(new [] {"-c", config})); } static void Copy(string project, string sourcePath, string destinationPath) { diff --git a/source/StoryTest/StoryTest.csproj b/source/StoryTest/StoryTest.csproj index 4b6bba9e..96f5d334 100644 --- a/source/StoryTest/StoryTest.csproj +++ b/source/StoryTest/StoryTest.csproj @@ -2,15 +2,15 @@ fitSharp.StoryTest - net48;net6.0;net6.0-windows;net7.0;net7.0-windows;net8.0;net8.0-windows + net48;net8.0;net8.0-windows;net9.0;net9.0-windows false false - - + + diff --git a/source/StoryTest/StoryTestL.csproj b/source/StoryTest/StoryTestL.csproj index c7a2ef3a..ffea8bee 100644 --- a/source/StoryTest/StoryTestL.csproj +++ b/source/StoryTest/StoryTestL.csproj @@ -2,7 +2,7 @@ fitSharp.StoryTest - net6.0 + net8.0 false false StoryTest diff --git a/source/TestTarget/TestTarget.csproj b/source/TestTarget/TestTarget.csproj index cdb45960..54be72e7 100644 --- a/source/TestTarget/TestTarget.csproj +++ b/source/TestTarget/TestTarget.csproj @@ -1,6 +1,6 @@  - net48;net6.0;net6.0-windows;net7.0;net7.0-windows;net8.0;net8.0-windows + net48;net8.0;net8.0-windows;net9.0;net9.0-windows fitSharp.TestTarget false false diff --git a/source/TestTarget/TestTargetL.csproj b/source/TestTarget/TestTargetL.csproj index 1cf76c19..2937d61c 100644 --- a/source/TestTarget/TestTargetL.csproj +++ b/source/TestTarget/TestTargetL.csproj @@ -1,6 +1,6 @@  - net6.0 + net8.0 fitSharp.TestTarget false false diff --git a/source/TestTarget2/TestTarget2.csproj b/source/TestTarget2/TestTarget2.csproj index 017008cc..c7001c4e 100644 --- a/source/TestTarget2/TestTarget2.csproj +++ b/source/TestTarget2/TestTarget2.csproj @@ -1,6 +1,6 @@  - net48;net6.0;net6.0-windows;net7.0;net7.0-windows;net8.0;net8.0-windows + net48;net8.0;net8.0-windows;net9.0;net9.0-windows fitSharp.TestTarget2 false false diff --git a/source/TestTarget2/TestTarget2L.csproj b/source/TestTarget2/TestTarget2L.csproj index 1437afe7..0f081e96 100644 --- a/source/TestTarget2/TestTarget2L.csproj +++ b/source/TestTarget2/TestTarget2L.csproj @@ -4,7 +4,7 @@ false false TestTarget2 - net6.0 + net8.0 diff --git a/source/dbfit/Properties/AssemblyInfo.cs b/source/dbfit/Properties/AssemblyInfo.cs deleted file mode 100644 index 1a0a723c..00000000 --- a/source/dbfit/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("DbFit for fitSharp")] -[assembly: AssemblyDescription("DbFit. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2.")] -[assembly: AssemblyProduct("fitSharp")] -[assembly: ComVisible(false)] - -[assembly: AssemblyCopyright("Copyright © 2007 Gojko Adzic, 2022 Syterra Software Inc. All rights reserved.")] -[assembly: AssemblyVersion("2022.1.15.0")] diff --git a/source/dbfit/dbfit.csproj b/source/dbfit/dbfit.csproj deleted file mode 100644 index bfc489c8..00000000 --- a/source/dbfit/dbfit.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - net48;net6.0;net6.0-windows;net7.0;net7.0-windows;net8.0;net8.0-windows - dbfit - false - false - - - - - - - - - \ No newline at end of file diff --git a/source/dbfit/environment/AbstractDbEnvironment.cs b/source/dbfit/environment/AbstractDbEnvironment.cs deleted file mode 100644 index 24ecce6b..00000000 --- a/source/dbfit/environment/AbstractDbEnvironment.cs +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright © 2015 Syterra Software Inc. Includes work Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. -// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data.Common; -using System.Data; -using System.Text.RegularExpressions; -using System.Text; -using dbfit.util; -using fitSharp.Machine.Engine; - -namespace dbfit -{ - /// - /// Utility class to simplify development of IDbEnvironment implementations. This class - /// has implementations for methods that will be common across most databases. It also provides - /// default accessors for the current connection and transaction. - /// - public abstract class AbstractDbEnvironment : IDbEnvironment - { - /// - /// optional prefix symbol that is added to parameter names in Sql commands. - /// - public abstract String ParameterPrefix { get; } - - #region default implementations for IDbEnvironment methods and properties - - private IDbConnection _currentConnection; - private IDbTransaction _currentTransaction; - - public IDbConnection CurrentConnection - { - get - { - return _currentConnection; - } - protected set - { - _currentConnection = value; - } - } - public IDbTransaction CurrentTransaction - { - get - { - return _currentTransaction; - } - protected set - { - _currentTransaction = value; - } - } - - public virtual void Connect(String dataSource, String username, String password, String database) - { - Connect(GetConnectionString(dataSource, username, password, database)); - } - public virtual void Connect(String dataSource, String username, String password) - { - Connect(GetConnectionString(dataSource, username, password)); - } - public virtual void Connect(String connectionString) - { - CurrentConnection = DbProviderFactory.CreateConnection(); - CurrentConnection.ConnectionString = connectionString; - CurrentConnection.Open(); - CurrentTransaction = CurrentConnection.BeginTransaction(); - } - public virtual void ConnectUsingFile(String connectionPropertiesFile) - { - DbConnectionProperties dbp = DbConnectionProperties.CreateFromFile(connectionPropertiesFile); - if (dbp.FullConnectionString != null) Connect(dbp.FullConnectionString); - else if (dbp.DbName != null) Connect(dbp.Service, dbp.Username, dbp.Password, dbp.DbName); - else Connect(dbp.Service, dbp.Username, dbp.Password); - } - - public virtual void ConnectUsingConfig(string connectionName) { - var fullConnectionString = ConfigurationManager.ConnectionStrings[connectionName].ConnectionString; - - if (fullConnectionString == null) { - throw new Exception(string.Format("No Connection String found for {0}", connectionName)); - } - Connect(fullConnectionString); - } - - public virtual void ConnectNoTransaction(String dataSource, String username, String password, String database) - { - string connectionString = GetConnectionString(dataSource, username, password, database); - CurrentConnection = DbProviderFactory.CreateConnection(); - CurrentConnection.ConnectionString = connectionString; - CurrentConnection.Open(); - } - protected virtual void AddInput(IDbCommand dbCommand, String name, Object value) - { - var dbParameter = dbCommand.CreateParameter(); - dbParameter.Direction = ParameterDirection.Input; - dbParameter.ParameterName = name; - dbParameter.Value = (value == null ? DBNull.Value : value); - dbCommand.Parameters.Add(dbParameter); - } - - public virtual IDbCommand CreateCommand(string statement, CommandType commandType) - { - if (CurrentConnection == null) throw new ApplicationException("Not connected to database"); - - var dc = CurrentConnection.CreateCommand(); - dc.CommandText = statement.Replace("\r", " ").Replace("\n", " "); - dc.CommandType = commandType; - dc.Transaction = CurrentTransaction; - dc.CommandTimeout = Options.CommandTimeOut; - return dc; - } - public virtual void BindFixtureSymbols(Symbols symbols, IDbCommand dc) - { - foreach (String paramName in ExtractParamNames(dc.CommandText)) - { - AddInput(dc, paramName, symbols.GetValueOrDefault(paramName, null)); - } - } - public void CloseConnection() - { - if (CurrentTransaction != null) - { - CurrentTransaction.Rollback(); - } - if (CurrentConnection != null) - { - CurrentConnection.Close(); - CurrentConnection = null; - CurrentTransaction = null; - } - } - public void Commit() - { - CurrentTransaction.Commit(); - CurrentTransaction = CurrentConnection.BeginTransaction(); - } - public void Rollback() - { - CurrentTransaction.Rollback(); - CurrentTransaction = CurrentConnection.BeginTransaction(); - } - - public virtual String BuildUpdateCommand(String tableName, DbParameterAccessor[] updateAccessors, DbParameterAccessor[] selectAccessors) - { - if (updateAccessors.Length == 0) - { - throw new ApplicationException("must have at least one field to update. Have you forgotten = after the column name?"); - } - var s = new StringBuilder("update ").Append(tableName).Append(" set "); - for (var i = 0; i < updateAccessors.Length; i++) - { - if (i > 0) s.Append(", "); - s.Append(BuildColumnName(updateAccessors[i].DbParameter.SourceColumn)).Append("="); - s.Append(ParameterPrefix).Append(updateAccessors[i].DbParameter.ParameterName); - } - s.Append(" where "); - for (var i = 0; i < selectAccessors.Length; i++) - { - if (i > 0) s.Append(" and "); - s.Append(BuildColumnName(selectAccessors[i].DbParameter.SourceColumn)).Append("="); - s.Append(ParameterPrefix).Append(selectAccessors[i].DbParameter.ParameterName); - } - return s.ToString(); - } - - public virtual string[] ExtractParamNames(string commandText) - { - //dotnet2 does not support sets, so a set is simmulated with a hashmap - Dictionary parameters = new Dictionary(); - MatchCollection mc = ParamNameRegex.Matches(commandText); - for (int i = 0; i < mc.Count; i++) parameters[mc[i].Groups[1].Value] = mc[i].Groups[1].Value; - string[] arr = new string[parameters.Keys.Count]; - parameters.Keys.CopyTo(arr, 0); - return arr; - } - - public virtual int GetExceptionCode(Exception dbException) - { - if (dbException is System.Data.Common.DbException) - { - System.Console.WriteLine("DBEXCEPTION:" + ((System.Data.Common.DbException)dbException).ErrorCode); - return ((System.Data.Common.DbException)dbException).ErrorCode; - } - else - { - System.Console.WriteLine("EXCEPTION:" + dbException.GetType().ToString()); - return 0; - } - } - - public virtual String BuildInsertCommand(String tableName, DbParameterAccessor[] accessors) - { - var sb = new StringBuilder("insert into "); - sb.Append(tableName).Append("("); - var separator = ""; - var values = new StringBuilder(); - foreach (var accessor in accessors) - { - sb.Append(separator); - values.Append(separator); - sb.Append(BuildColumnName(accessor.DbParameter.SourceColumn)); - values.Append(ParameterPrefix).Append(accessor.DbParameter.ParameterName); - separator = ","; - } - sb.Append(") values ("); - sb.Append(values); - sb.Append(")"); - return sb.ToString(); - } - - #endregion - - #region inherited methods from IDbEnvironment that have no default implementation - - protected abstract String GetConnectionString(String dataSource, String username, String password); - protected abstract String GetConnectionString(String dataSource, String username, String password, String database); - protected abstract Regex ParamNameRegex { get; } - public abstract DbProviderFactory DbProviderFactory { get ; } - public abstract Dictionary GetAllProcedureParameters(string procName); - public abstract Dictionary GetAllColumns(string tableOrViewName); - - public abstract bool SupportsReturnOnInsert { get;} - public abstract String IdentitySelectStatement(String tableName); -#endregion - - protected virtual string BuildColumnName(string sourceColumnName) { return sourceColumnName; } - } -} diff --git a/source/dbfit/environment/DbEnvironment.cs b/source/dbfit/environment/DbEnvironment.cs deleted file mode 100644 index 0a98f2b0..00000000 --- a/source/dbfit/environment/DbEnvironment.cs +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright © 2015 Syterra Software Inc. Includes work Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. -// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -using System; -using System.Collections.Generic; -using System.Data.Common; -using System.Data; -using fitSharp.Machine.Engine; - -namespace dbfit { - /// - /// IDbEnvironment provides a common interface for database-specific meta-data retrieval - /// and operations. IDbEnvironment instances encapculate all database-specific functionality, - /// so that DbFit fixtures can be database-neutral. IDbEnvironment instances are also - /// responsible for transaction management. - /// - public interface IDbEnvironment { - /// - /// Retrieves an instance of DbProviderFactory class that can be used - /// to create database-specific implementations of database parameters, - /// data-set readers etc - /// - DbProviderFactory DbProviderFactory { get ; } - /// - /// A flag to signal whether the database supports output parameters on insert commands, - /// or whether the auto-generated identity values have to be retrieved with a separate - /// statement after insert. - /// - bool SupportsReturnOnInsert { get ;} - /// - /// If the database requires an additional statement to fetch auto-generated identity values passing the table name, - /// this property is used as the select query to execute that statement. - /// - String IdentitySelectStatement(String tableName); - /// - /// Meta-data retrieval method that provides a list of parameters for a given stored procedure - /// or function name. The name may contain a schema qualifier. - /// - /// name of the procedure or function to look up in the database - /// a map of parameter names to DbParameterAccessor objects for procedure parameters - Dictionary GetAllProcedureParameters(string procName); - - /// - /// Meta-data retrieval method that provides a list of columns a given stored table - /// or view. The name may contain a schema qualifier. - /// - /// name of the table or view to look up in the database - /// a map of column names to DbParameterAccessor objects for table columns - - Dictionary GetAllColumns(string tableOrViewName); - /// - /// This method creates an insert command that will be used to populate new rows in a table - /// - /// table or view name to be used for inserting - /// list of columns that will be used in the insert command - /// Command string in the appropriate form, with parameter placeholders - String BuildInsertCommand(String tableName, DbParameterAccessor[] accessors); - /// - /// This method should create and initialise a DbCommand object based on the current - /// IDbEnvironment connection and transaction. - /// - /// Command text to execute - /// Statement type - /// initialised DbCommand object - IDbCommand CreateCommand(string statement, CommandType commandType); - /// - /// Closes the current connection and rolls back any active transactions. The transactions - /// are automatically rolled back to make tests repeatable. - /// - void CloseConnection(); - /// - /// Connects to the database using a default database for the user - /// - /// Host (optionally port), machine name or any other data source identifier - void Connect(String dataSource, String username, String password); - - /// - /// Connects to the database using a specified database for the user - /// - /// Host (optionally port), machine name or any other data source identifier - /// default database after connection - void Connect(String dataSource, String username, String password, String database); - - /// - /// Connects using a database-specific connection string. This allows users to specify - /// parameters that would not be used otherwise (i.e. windows integrated security) - /// - /// full ADO.NET connection string - void Connect(String connectionString); - - /// - /// Load database properties from a file and connect. - /// The connection properties file is a plain text file, containing key/value pairs separarted by the equals symbol (=). Lines starting with a hash (#) are ignored. Use the following keys (they care case-sensitive): - /// - /// 1. service -- service name. In the previous example, it was LAPTOP\SQLEXPRESS. - /// 2. username -- username to connect to the database. In the previous example, it was FitNesseUser. - /// 3. password -- password to connect to the database. In the previous example, it was Password. - /// 4. database -- optional fourth argument, allowing you to choose the active database. In the previous example, it was TestDB. - /// 5. connection-string -- alternative to the four previous parameters, this allows you to specify the full connection string. This parameter should not be mixed with any of the four other keys. Use either the full string or specify individual properties. - /// - /// Here is an example: - /// - /// # DBFit connection properties file - /// # - /// #1) Either specify full connection string - /// #connection-string= - /// # - /// #2) OR specify service, username and password as separate properties - /// service=localhost - /// username=root - /// password= - /// #optionally specify a database name - /// database=dbfit - /// - /// - void ConnectUsingFile(String connectionPropertiesFile); - - void ConnectUsingConfig(string connectionName); - - /// - /// Connects to the database using a specified database for the user witout a transaction - /// - /// Host (optionally port), machine name or any other data source identifier - /// default database after connection - void ConnectNoTransaction(String dataSource, String username, String password, String database); - - /// - /// bind any fixture symbols that match command parameters to this command. - /// symbols that have no matching parameters are ignored. - /// - /// - void BindFixtureSymbols(Symbols symbols, IDbCommand dc); - - /// - /// Commit current transaction - /// - void Commit(); - - /// - /// Rollback current transaction - /// - void Rollback(); - /// - /// Retrieve an exception code from a database exception. This method should perform - /// any required conversion between a .NET exception and the real database error code. - /// - int GetExceptionCode(Exception ex); - - /// - /// Utility method that creates an update command statement - /// - /// table or view being updated - /// fields that are being modified - /// fields used for selecting affected records - /// - String BuildUpdateCommand(String tableName, DbParameterAccessor[] updateAccessors, - DbParameterAccessor[] selectAccessors); - /// - /// Accessor for the current database connection, used by DBFit Fixtures - /// - IDbConnection CurrentConnection { get; } - /// - /// Accessor for the current database transaction, used by DBFit Fixtures - /// - IDbTransaction CurrentTransaction { get; } - - } -} \ No newline at end of file diff --git a/source/dbfit/environment/DbEnvironmentFactory.cs b/source/dbfit/environment/DbEnvironmentFactory.cs deleted file mode 100644 index ef7831ed..00000000 --- a/source/dbfit/environment/DbEnvironmentFactory.cs +++ /dev/null @@ -1,22 +0,0 @@ -/// Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -/// Released under GNU GPL 2.0 -using System; -using System.Collections.Generic; -using System.Text; - -namespace dbfit { - /// - /// Static singleton holder for an IDbEnvironment instance that is used - /// as the "current" environment in standalone mode. This class can also - /// be used by 3rd party fixtures to access DbFit features or execute - /// statements in the same transaction. - /// - public class DbEnvironmentFactory { - private static IDbEnvironment instance; - public static IDbEnvironment DefaultEnvironment - { - get { return instance; } - set { instance=value; } - } - } -} diff --git a/source/dbfit/fixture/Clean.cs b/source/dbfit/fixture/Clean.cs deleted file mode 100644 index da77fccb..00000000 --- a/source/dbfit/fixture/Clean.cs +++ /dev/null @@ -1,92 +0,0 @@ -/// Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -/// Released under GNU GPL 2.0 -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Common; -using System.Text; - -using fit; - - -namespace dbfit.fixture { - /// - /// Deprecated fixture that can be used to clean up the database. Kept only for - /// legacy compatibility. Use Execute fixture with a Delete command instead of this. - /// - public class Clean:fit.ColumnFixture { - - private IDbEnvironment environment; - public Clean(IDbEnvironment environment) { - this.environment = environment; - } - public Clean() - { - this.environment = DbEnvironmentFactory.DefaultEnvironment; - } - public String table; - public String columnName; - public Decimal[] ids; - public String[] keys; - public string where=null; - private string getIDCSV() - { - StringBuilder sb = new StringBuilder(); - String comma = ""; - foreach (decimal x in ids) - { - sb.Append(comma); - sb.Append(x.ToString()); - comma = ", "; - } - return sb.ToString(); - } - private string getKeyCSV() - { - StringBuilder sb = new StringBuilder(); - String comma = ""; - foreach (String x in keys) - { - sb.Append(comma); - sb.Append("'"); - sb.Append(x.ToString()); - sb.Append("'"); - comma = ", "; - } - return sb.ToString(); - } - - private bool hadRowOperation=false; - public bool clean() { - var command = environment.CreateCommand( - "Delete from " + table +(where!=null?" where "+where:""), CommandType.Text); - command.ExecuteNonQuery(); - return true; - } - public bool DeleteRowsForIDs() - { - var command = environment.CreateCommand( - "Delete from " + table + " where "+columnName +" in (" - + getIDCSV()+") "+(where != null ? " and " + where : ""), CommandType.Text); - command.ExecuteNonQuery(); - hadRowOperation=true; - return true; - } - public bool DeleteRowsForKeys() - { - var command = environment.CreateCommand( - "Delete from " + table + " where " + columnName + " in (" - + getKeyCSV() + ") " + (where != null ? " and " + where : ""), CommandType.Text); - command.ExecuteNonQuery(); - hadRowOperation=true; - return true; - } - public override void DoRow(Parse row) { - hadRowOperation = false; - base.DoRow(row); - if (!hadRowOperation) { - clean(); - } - } - } -} \ No newline at end of file diff --git a/source/dbfit/fixture/CompareStoredQueries.cs b/source/dbfit/fixture/CompareStoredQueries.cs deleted file mode 100644 index 15a016fb..00000000 --- a/source/dbfit/fixture/CompareStoredQueries.cs +++ /dev/null @@ -1,227 +0,0 @@ -/// Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -/// Released under GNU GPL 2.0 -using System; -using System.Collections.Generic; -using fit; -using System.Data; -using dbfit.util; -using fitSharp.Fit.Model; -using fitSharp.Machine.Model; - -namespace dbfit.fixture -{ - /// - /// This fixture compares two DataTable objects and prints out any unmatched rows. - /// DataTables are read from Fixture symbols. - /// - public class CompareStoredQueries:fit.Fixture - { - private IDbEnvironment dbEnvironment; - private String symbol1; - private String symbol2; - private DataTable dt1; - private DataTable dt2; - private String[] columnNames; - private bool[] keyProperties; - /// - /// Constructor that will use the default environment (from DbEnvironmentFactory) and - /// read the DataTable objects to compare from symbols contained in the first - /// two fixture arguments. Intended for use in standalone mode. - /// - public CompareStoredQueries() - { - dbEnvironment = DbEnvironmentFactory.DefaultEnvironment; - } - /// - /// Constructor that allows the caller to pass an IDbEnvironment instance and two symbol names - /// that will be used to retrieve DataTable objects for comparison. Intended for use in flow mode. - /// - /// - /// Symbol name for the fixture symbol containing the first DataTable - /// Symbol name for the fixture symbol containing the second DataTable - public CompareStoredQueries(IDbEnvironment environment, String symbol1, String symbol2) - { - this.dbEnvironment = environment; - this.symbol1 = symbol1; - this.symbol2 = symbol2; - } - private DataTable GetDataTable(String symbolName){ - Object o=Symbols.GetValueOrDefault(symbolName, null); - if (o==null) throw new ApplicationException("Cannot load a stored query from "+symbolName+ " - is is empty"); - if (o.GetType().Equals(typeof(DataTable))) return (DataTable) o; - throw new ApplicationException("Cannot load stored query from "+symbolName - + " - object type is "+o.GetType().Name); - } - private void InitialiseDataTables() - { - if (symbol1 == null || symbol2 == null) - { - if (Args.Length < 2) - throw new ApplicationException("No symbols specified to CompareStoreQueries constructor or argument list"); - symbol1 = Args[0]; - symbol2 = Args[1]; - } - if (symbol1.StartsWith("<<")) symbol1 = symbol1.Substring(2); - if (symbol2.StartsWith("<<")) symbol2 = symbol2.Substring(2); - // tables will be modified during comparison, so better to clone - dt1 = GetDataTable(symbol1).Copy(); - dt2 = GetDataTable(symbol2).Copy(); - } - private void LoadRowStructure(Parse headerRow) - { - Parse headerCell = headerRow.Parts; - int colNum = headerRow.Parts.Size; - columnNames = new String[colNum]; - keyProperties = new bool[colNum]; - for (int i = 0; i < colNum; i++) - { - String currentName = headerCell.Text; - if (currentName == null) throw new ApplicationException("Column " + i + " does not have a name"); - currentName = currentName.Trim(); - if (currentName.Length == 0) throw new ApplicationException("Column " + i + " does not have a name"); - columnNames[i] = NameNormaliser.NormaliseName(currentName); - keyProperties[i] = !currentName.EndsWith("?"); - headerCell = headerCell.More; - } - } - public override void DoTable(Parse table) - { - InitialiseDataTables(); - Parse lastRow=table.Parts.More; - if (lastRow==null){ - throw new ApplicationException("Query structure missing from second row"); - } - LoadRowStructure(lastRow); - lastRow=ProcessDataTable(dt1,dt2, lastRow, symbol2); - - foreach (DataRow dr in dt2.Rows){ - lastRow=AddRow(lastRow, dr, true, " missing from "+symbol1); - } - } - - private String GetStringValue(DataRow dr, String colName) - { - Object o = dr[colName]; - if (o == null) return "null"; - return o.ToString(); - } - - private Parse AddRow(Parse lastRow, DataRow dr, bool markAsError, String desc) - { - Parse newRow = new Parse("tr", null, null, null); - lastRow.More = newRow; - lastRow = newRow; - try - { - Parse firstCell = new Parse("td", - GetStringValue(dr, columnNames[0]), null, null); - newRow.Parts = firstCell; - if (markAsError) - { - firstCell.AddToBody(Fixture.Gray(desc)); - this.Wrong(firstCell); - } - for (int i = 1; i < columnNames.Length; i++) - { - Parse nextCell = new Parse("td", - GetStringValue(dr, columnNames[i]), null, null); - firstCell.More = nextCell; - firstCell = nextCell; - } - } - catch (Exception e) - { - this.Exception(newRow, e); - } - return lastRow; - } - private Parse addRow(Parse lastRow, DataRow dr, DataRow dr2) - { - Parse newRow = new Parse("tr", null, null, null); - lastRow.More = newRow; - lastRow = newRow; - try - { - String lval = GetStringValue(dr, columnNames[0]); - String rval = GetStringValue(dr2, columnNames[0]); - Parse firstCell = new Parse("td", lval, null, null); - newRow.Parts = firstCell; - if (!lval.Equals(rval)) - { - Wrong(firstCell, rval); - } - else - { - Right(firstCell); - } - for (int i = 1; i < columnNames.Length; i++) - { - lval = GetStringValue(dr, columnNames[i]); - rval = GetStringValue(dr2, columnNames[i]); - Parse nextCell = new Parse("td", - lval, null, null); - firstCell.More = nextCell; - firstCell = nextCell; - if (!lval.Equals(rval)) - { - Wrong(firstCell, rval); - } - else - { - Right(firstCell); - } - } - } - catch (Exception e) - { - Exception(newRow, e); - } - return lastRow; - } - private bool IsMatch(DataRow dr, IDictionary matchingMask) - { - foreach (String key in matchingMask.Keys){ - object val = matchingMask[key]; - object drval = dr[key]; - if (val == null){ - if (drval!=null) return false; - } - else { - if (!val.Equals(drval)) return false; - } - } - return true; - } - private DataRow FindMatching(DataTable t, IDictionary matchingMask) - { - foreach (DataRow dr in t.Rows){ - if (IsMatch(dr,matchingMask)) return dr; - } - return null; - } - private Parse ProcessDataTable(DataTable t1, DataTable t2, Parse lastScreenRow, String queryName) - { - - foreach (DataRow dr in t1.Rows) - { - IDictionary matchingMask = new Dictionary(); - for (int i = 0; i < keyProperties.Length; i++) - { - if (keyProperties[i]) - matchingMask[columnNames[i]] = dr[columnNames[i]]; - } - DataRow dr2 = FindMatching(t2, matchingMask); - if (dr2 != null) - { - lastScreenRow = addRow(lastScreenRow, dr, dr2); - t2.Rows.Remove(dr2); - } - else - { - lastScreenRow = AddRow(lastScreenRow, dr, true, " missing from " + queryName); - } - } - return lastScreenRow; - } - } -} diff --git a/source/dbfit/fixture/CompareStoredQueriesHideMatchingRows.cs b/source/dbfit/fixture/CompareStoredQueriesHideMatchingRows.cs deleted file mode 100644 index f158705c..00000000 --- a/source/dbfit/fixture/CompareStoredQueriesHideMatchingRows.cs +++ /dev/null @@ -1,227 +0,0 @@ -/// Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -/// Released under GNU GPL 2.0 -using System; -using System.Collections.Generic; -using fit; -using System.Data; -using dbfit.util; -using fitSharp.Fit.Model; -using fitSharp.Machine.Model; - -namespace dbfit.fixture -{ - /// - /// This fixture compares two DataTable objects and prints out any unmatched rows. - /// DataTables are read from Fixture symbols. - /// - public class CompareStoredQueriesHideMatchingRows:fit.Fixture - { - private IDbEnvironment dbEnvironment; - private String symbol1; - private String symbol2; - private DataTable dt1; - private DataTable dt2; - private String[] columnNames; - private bool[] keyProperties; - /// - /// Constructor that will use the default environment (from DbEnvironmentFactory) and - /// read the DataTable objects to compare from symbols contained in the first - /// two fixture arguments. Intended for use in standalone mode. - /// - public CompareStoredQueriesHideMatchingRows() - { - dbEnvironment = DbEnvironmentFactory.DefaultEnvironment; - } - /// - /// Constructor that allows the caller to pass an IDbEnvironment instance and two symbol names - /// that will be used to retrieve DataTable objects for comparison. Intended for use in flow mode. - /// - /// - /// Symbol name for the fixture symbol containing the first DataTable - /// Symbol name for the fixture symbol containing the second DataTable - public CompareStoredQueriesHideMatchingRows(IDbEnvironment environment, String symbol1, String symbol2) - { - this.dbEnvironment = environment; - this.symbol1 = symbol1; - this.symbol2 = symbol2; - } - private DataTable GetDataTable(String symbolName){ - Object o=Symbols.GetValueOrDefault(symbolName, null); - if (o==null) throw new ApplicationException("Cannot load a stored query from "+symbolName+ " - is is empty"); - if (o.GetType().Equals(typeof(DataTable))) return (DataTable) o; - throw new ApplicationException("Cannot load stored query from "+symbolName - + " - object type is "+o.GetType().Name); - } - private void InitialiseDataTables() - { - if (symbol1 == null || symbol2 == null) - { - if (Args.Length < 2) - throw new ApplicationException("No symbols specified to CompareStoreQueries constructor or argument list"); - symbol1 = Args[0]; - symbol2 = Args[1]; - } - if (symbol1.StartsWith("<<")) symbol1 = symbol1.Substring(2); - if (symbol2.StartsWith("<<")) symbol2 = symbol2.Substring(2); - // tables will be modified during comparison, so better to clone - dt1 = GetDataTable(symbol1).Copy(); - dt2 = GetDataTable(symbol2).Copy(); - } - private void LoadRowStructure(Parse headerRow) - { - Parse headerCell = headerRow.Parts; - int colNum = headerRow.Parts.Size; - columnNames = new String[colNum]; - keyProperties = new bool[colNum]; - for (int i = 0; i < colNum; i++) - { - String currentName = headerCell.Text; - if (currentName == null) throw new ApplicationException("Column " + i + " does not have a name"); - currentName = currentName.Trim(); - if (currentName.Length == 0) throw new ApplicationException("Column " + i + " does not have a name"); - columnNames[i] = NameNormaliser.NormaliseName(currentName); - keyProperties[i] = !currentName.EndsWith("?"); - headerCell = headerCell.More; - } - } - public override void DoTable(Parse table) - { - InitialiseDataTables(); - Parse lastRow=table.Parts.More; - if (lastRow==null){ - throw new ApplicationException("Query structure missing from second row"); - } - LoadRowStructure(lastRow); - lastRow=ProcessDataTable(dt1,dt2, lastRow, symbol2); - - foreach (DataRow dr in dt2.Rows){ - lastRow=AddRow(lastRow, dr, true, " missing from "+symbol1); - } - } - - private String GetStringValue(DataRow dr, String colName) - { - Object o = dr[colName]; - if (o == null) return "null"; - return o.ToString(); - } - - private Parse AddRow(Parse lastRow, DataRow dr, bool markAsError, String desc) - { - Parse newRow = new Parse("tr", null, null, null); - lastRow.More = newRow; - lastRow = newRow; - try - { - Parse firstCell = new Parse("td", - GetStringValue(dr, columnNames[0]), null, null); - newRow.Parts = firstCell; - if (markAsError) - { - firstCell.AddToBody(Fixture.Gray(desc)); - this.Wrong(firstCell); - } - for (int i = 1; i < columnNames.Length; i++) - { - Parse nextCell = new Parse("td", - GetStringValue(dr, columnNames[i]), null, null); - firstCell.More = nextCell; - firstCell = nextCell; - } - } - catch (Exception e) - { - this.Exception(newRow, e); - } - return lastRow; - } - private Parse addRow(Parse lastRow, DataRow dr, DataRow dr2) - { - Parse newRow = new Parse("tr", null, null, null); - lastRow.More = newRow; - lastRow = newRow; - try - { - String lval = GetStringValue(dr, columnNames[0]); - String rval = GetStringValue(dr2, columnNames[0]); - Parse firstCell = new Parse("td", lval, null, null); - newRow.Parts = firstCell; - if (!lval.Equals(rval)) - { - Wrong(firstCell, rval); - } - else - { - Right(firstCell); - } - for (int i = 1; i < columnNames.Length; i++) - { - lval = GetStringValue(dr, columnNames[i]); - rval = GetStringValue(dr2, columnNames[i]); - Parse nextCell = new Parse("td", - lval, null, null); - firstCell.More = nextCell; - firstCell = nextCell; - if (!lval.Equals(rval)) - { - Wrong(firstCell, rval); - } - else - { - Right(firstCell); - } - } - } - catch (Exception e) - { - Exception(newRow, e); - } - return lastRow; - } - private bool IsMatch(DataRow dr, IDictionary matchingMask) - { - foreach (String key in matchingMask.Keys){ - object val = matchingMask[key]; - object drval = dr[key]; - if (val == null){ - if (drval!=null) return false; - } - else { - if (!val.Equals(drval)) return false; - } - } - return true; - } - private DataRow FindMatching(DataTable t, IDictionary matchingMask) - { - foreach (DataRow dr in t.Rows){ - if (IsMatch(dr,matchingMask)) return dr; - } - return null; - } - private Parse ProcessDataTable(DataTable t1, DataTable t2, Parse lastScreenRow, String queryName) - { - - foreach (DataRow dr in t1.Rows) - { - IDictionary matchingMask = new Dictionary(); - for (int i = 0; i < keyProperties.Length; i++) - { - if (keyProperties[i]) - matchingMask[columnNames[i]] = dr[columnNames[i]]; - } - DataRow dr2 = FindMatching(t2, matchingMask); - if (dr2 != null) - { - //lastScreenRow = addRow(lastScreenRow, dr, dr2); - t2.Rows.Remove(dr2); - } - else - { - lastScreenRow = AddRow(lastScreenRow, dr, true, " missing from " + queryName); - } - } - return lastScreenRow; - } - } -} diff --git a/source/dbfit/fixture/DatabaseEnvironment.cs b/source/dbfit/fixture/DatabaseEnvironment.cs deleted file mode 100644 index 7b9cc4a0..00000000 --- a/source/dbfit/fixture/DatabaseEnvironment.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright © 2010 Syterra Software Inc. Includes work Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. -// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -using System; -using fitSharp.Fit.Model; -using fitSharp.Machine.Engine; -using fitSharp.Machine.Model; - -namespace dbfit.fixture -{ - /// - /// Utility fixture that provides database control features in standalone mode. This fixture - /// should be used to connect/disconnect and manipulate transactions when the flow mode - /// cannot be used. It is also used to control dbfit options and advanced features. - /// - /// If it has a fixture argument, that argument is used to initialise a new IDbEnvironment object. - /// The argument value should be the type of required IDbInstance implementation, like - /// ORACLE, SQLSERVER, SQLSERVER2000 or DB2. That object is then stored for later use in the - /// DbEnvironmentFactory singleton. - /// - /// If there are no fixture arguments, then the last previously initialised - /// IDbEnvironment object is used. - /// - /// - public class DatabaseEnvironment : fitlibrary.SequenceFixture - { - public DatabaseEnvironment(){ - mySystemUnderTest=DbEnvironmentFactory.DefaultEnvironment; - } - public override void DoTable(fit.Parse theTable) - { - if (Args.Length>0){ - String requestedEnv=Args[0].ToUpper().Trim(); - IDbEnvironment env; - if ("ORACLE".Equals(requestedEnv)) - env = MakeEnvironment("dbfit.OracleEnvironment"); - else if ("SQLSERVER".Equals(requestedEnv)) - env = MakeEnvironment("dbfit.SqlServerEnvironment"); - else if ("SQLSERVER2000".Equals(requestedEnv)) - env = MakeEnvironment("dbfit.SqlServer2000Environment"); - else if ("SYBASE".Equals(requestedEnv)) - env = MakeEnvironment("dbfit.SybaseEnvironment"); - else if ("MYSQL".Equals(requestedEnv)) - env = MakeEnvironment("dbfit.MySqlEnvironment"); - /* else if ("DB2".Equals(requestedEnv)) - env = Processor.Create("DB2Environment", new TreeList()); */ - else - throw new ApplicationException("DB Environment not supported " + requestedEnv); - DbEnvironmentFactory.DefaultEnvironment=env; - mySystemUnderTest=DbEnvironmentFactory.DefaultEnvironment; - } - base.DoTable(theTable); - } - - private IDbEnvironment MakeEnvironment(string name) { - return Processor.Create(name, new CellTree()).GetValue(); - } - - /// - /// set the value of DbFit options. See dbfit.util.options for more information - /// - /// option name - /// option vaue - public void SetOption(String option, String value) - { - util.Options.SetOption(Processor, option, value); - } - } -} diff --git a/source/dbfit/fixture/DatabaseTest.cs b/source/dbfit/fixture/DatabaseTest.cs deleted file mode 100644 index ba3f3062..00000000 --- a/source/dbfit/fixture/DatabaseTest.cs +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright � 2015 Syterra Software Inc. Includes work Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. -// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -using System; -using System.Data; -using System.Data.Common; -using dbfit.fixture; -using dbfit.util; -using fit; - -using fitlibrary; -using fitSharp.Machine.Engine; - -namespace dbfit -{ - public class DatabaseTest : SequenceFixture - { - protected IDbEnvironment environment; - - public void SetUp() { - util.Options.reset(); - } - - public void TearDown() { - environment.CloseConnection(); - } - - public DatabaseTest(IDbEnvironment environment) - { - this.environment = environment; - } - - public void Connect(String dataSource, String username, String password, String database) - { - environment.Connect(dataSource, username, password, database); - } - - public void Connect(String dataSource, String username, String password) - { - environment.Connect(dataSource, username, password); - } - - public void Connect(String connectionString) - { - environment.Connect(connectionString); - } - - public void ConnectUsingFile(String path) - { - environment.ConnectUsingFile(path); - } - - public void ConnectUsingConfig(string connectionName) { - environment.ConnectUsingConfig(connectionName); - } - - public void Close() - { - environment.CloseConnection(); - } - - public void SetParameter(String name, object value) - { - fixture.SetParameter.SetParameterValue(Symbols, name, value); - } - - public Fixture SetTableParameter(String name, String type) - { - return new SetTableParameter(environment, Symbols, name, type); - } - - public void ClearParameters() - { - Symbols.Clear(); - } - - public Fixture Query(String query) - { - return new Query(GetDataTable(Symbols, query, environment), false); - } - - public Fixture Query(String query, int resultSet) - { - return new Query(GetDataTable(Symbols, query, environment, resultSet), false); - } - - public Fixture Query(DataTable queryTable) - { - return new Query(queryTable, false); - } - - public Fixture Update(String table) - { - return new Update(environment, table); - } - - public Fixture OrderedQuery(String query) - { - return new Query(GetDataTable(Symbols, query, environment), true); - } - - public Fixture Execute(String statement) - { - return new Execute(environment, statement); - } - - public Fixture ExecuteDDL(String statement) - { - return new ExecuteDDL(environment, statement); - } - - public Fixture Insert(String table) - { - return new Insert(environment, table); - } - - public Fixture ExecuteProcedure(String procedure) - { - return new ExecuteProcedure(environment, procedure); - } - - public Fixture ExecuteProcedureExpectException(String procedure) - { - return new ExecuteProcedure(environment, procedure, true); - } - - public Fixture ExecuteProcedureExpectException(String procedure, int errorCode) - { - return new ExecuteProcedure(environment, procedure, errorCode); - } - - public void Commit() - { - environment.Commit(); - } - - public void Rollback() - { - environment.Rollback(); - } - - public Fixture QueryStats() - { - return new QueryStats(environment); - } - - public Fixture Clean() - { - return new Clean(environment); - } - - public Fixture InspectProcedure(String procedure) - { - return new Inspect(environment, Inspect.MODE_PROCEDURE, procedure); - } - - public Fixture InspectTable(String table) - { - return new Inspect(environment, Inspect.MODE_TABLE, table); - } - - public Fixture InspectView(String view) - { - return new Inspect(environment, Inspect.MODE_TABLE, view); - } - - public Fixture InspectQuery(String query) - { - return new Inspect(environment, Inspect.MODE_QUERY, query); - } - - public Fixture StoreQuery(String query, String symbolName) - { - return new StoreQuery(environment, query, symbolName); - } - - public Fixture CompareStoredQueries(String symbol1, String symbol2) - { - return new CompareStoredQueries(environment, symbol1, symbol2); - } - - public Fixture CompareStoredQueriesHideMatchingRows(String symbol1, String symbol2) - { - return new CompareStoredQueriesHideMatchingRows(environment, symbol1, symbol2); - } - - public void SetOption(String option, String value) - { - util.Options.SetOption(Processor, option, value); - } - - public static DataTable GetDataTable(Symbols symbols, String query, IDbEnvironment environment) - { - return GetDataTable(symbols, query, environment, 1); - } - - public static DataTable GetDataTable(Symbols symbols, String query,IDbEnvironment environment, int rsNo) - { - var dc = environment.CreateCommand(query, CommandType.Text); - if (Options.ShouldBindSymbols()) - environment.BindFixtureSymbols(symbols, dc); - - var oap = environment.DbProviderFactory.CreateDataAdapter(); - oap.SelectCommand = (DbCommand)dc; - var ds = new DataSet(); - oap.Fill(ds); - dc.Dispose(); - return ds.Tables[rsNo - 1]; - } - } -} diff --git a/source/dbfit/fixture/Execute.cs b/source/dbfit/fixture/Execute.cs deleted file mode 100644 index 6e93b873..00000000 --- a/source/dbfit/fixture/Execute.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using fit; -using System.Data; -using System.Data.Common; -namespace dbfit.fixture -{ - public class Execute:fit.Fixture - { - private IDbEnvironment environment; - private String statement; - public Execute() - { - environment = DbEnvironmentFactory.DefaultEnvironment; - } - public Execute(IDbEnvironment environment, String statement) - { - this.environment = environment; - this.statement = statement; - } - public override void DoRows(Parse rows) - { - if (String.IsNullOrEmpty(statement)) - statement = Args[0]; - using (var dc = environment.CreateCommand(statement, CommandType.Text)) - { - if (dbfit.util.Options.ShouldBindSymbols()) - environment.BindFixtureSymbols(Symbols, dc); - dc.ExecuteNonQuery(); - } - } - } -} diff --git a/source/dbfit/fixture/ExecuteDDL.cs b/source/dbfit/fixture/ExecuteDDL.cs deleted file mode 100644 index 77397a19..00000000 --- a/source/dbfit/fixture/ExecuteDDL.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using fit; -using System.Data; -using System.Data.Common; -namespace dbfit.fixture -{ - public class ExecuteDDL:fit.Fixture - { - private IDbEnvironment environment; - private String statement; - public ExecuteDDL() - { - environment = DbEnvironmentFactory.DefaultEnvironment; - } - public ExecuteDDL(IDbEnvironment environment, String statement) - { - this.environment = environment; - this.statement = statement; - } - public override void DoRows(Parse rows) - { - if (String.IsNullOrEmpty(statement)) - statement = Args[0]; - using (var dc = environment.CreateCommand(statement, CommandType.Text)) - { - dc.ExecuteNonQuery(); - } - } - } -} diff --git a/source/dbfit/fixture/ExecuteProcedure.cs b/source/dbfit/fixture/ExecuteProcedure.cs deleted file mode 100644 index 84aaf210..00000000 --- a/source/dbfit/fixture/ExecuteProcedure.cs +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright © 2012 Syterra Software Inc. Includes work Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. -// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Common; - -using fit; -using dbfit.util; -using fitSharp.Fit.Operators; -using fitSharp.Fit.Service; -using fitSharp.Machine.Engine; - -namespace dbfit.fixture -{ - public class ExecuteProcedure : ColumnFixture, MemberQueryable - { - private readonly IDbEnvironment dbEnvironment; - private readonly bool expectException; - private readonly List accessors = new List(); - private IDbCommand command; - private String procedureName; - private int? errorCode; - private Parse currentRow; - private ColumnAccessors columnAccessors; - - public ExecuteProcedure() - { - dbEnvironment = DbEnvironmentFactory.DefaultEnvironment; - } - public ExecuteProcedure(IDbEnvironment dbEnvironment, String procedureName, bool expectException) - { - this.procedureName = procedureName; - this.dbEnvironment = dbEnvironment; - this.expectException = expectException; - errorCode = null; - } - public ExecuteProcedure(IDbEnvironment dbEnvironment, String procedureName, int errorCode) - { - this.procedureName = procedureName; - this.dbEnvironment = dbEnvironment; - expectException = true; - this.errorCode = errorCode; - } - public ExecuteProcedure(IDbEnvironment dbEnvironment, String procedureName) - : this(dbEnvironment, procedureName, false) - { - } - public override void DoRows(Parse rows) - { - if (String.IsNullOrEmpty(procedureName)) procedureName = Args[0]; - if (rows != null) - { - InitParameters(rows.Parts); - InitCommand(); - base.DoRows(rows); - } - else - { - columnAccessors = new ColumnAccessors(); - InitCommand(); - command.ExecuteNonQuery(); - } - } - - public override void DoRow(Parse row) { - currentRow = row; - base.DoRow(row); - } - - public override void DoCells(Parse cells) { - ProcessCells(cells, b => !b.IsCheck); - ProcessCells(cells, b => b.IsCheck); - } - - private void ProcessCells(Parse cells, Func bindingFilter) { - int i = 0; - for (Parse cell = cells; cell != null && i < ColumnBindings.Length; cell = cell.More, i++) { - if (!bindingFilter(ColumnBindings[i])) continue; - try { - DoCell(cell, i); - } - catch (Exception e) { - TestStatus.MarkException(cells, e); - } - } - } - - public static DbParameterAccessor[] SortAccessors(IEnumerable accessors) - { - var sortedAccessors = new List(accessors); - for (int i = 0; i < sortedAccessors.Count - 1; i++) - for (int j = i + 1; j < sortedAccessors.Count; j++) - { - if (sortedAccessors[i].Position <= sortedAccessors[j].Position) continue; - DbParameterAccessor x = sortedAccessors[i]; - sortedAccessors[i] = sortedAccessors[j]; - sortedAccessors[j] = x; - } - return sortedAccessors.ToArray(); - } - private void InitCommand() - { - command = dbEnvironment.CreateCommand(procedureName, CommandType.StoredProcedure); - DbParameterAccessor[] sortedAccessors = SortAccessors(accessors); - - foreach (DbParameterAccessor accessor in sortedAccessors) - { - // in/out params can cause the same parameter to be added twice, - // check to avoid that - if (!command.Parameters.Contains(accessor.DbParameter)) - command.Parameters.Add(accessor.DbParameter); - } - } - - public override void Execute() { - if (expectException) { - try { - command.ExecuteNonQuery(); - Wrong(currentRow); - } - catch (Exception e) { - currentRow.Parts.Last.More = new Parse("td", Gray(e.ToString()), null, null); - if (errorCode.HasValue) { - if (dbEnvironment.GetExceptionCode(e) == errorCode) - Right(currentRow); - else - Wrong(currentRow); - } - else - Right(currentRow); - } - } - else { - command.ExecuteNonQuery(); - } - } - - private void InitParameters(Parse headerCells) - { - Dictionary allParams = - dbEnvironment.GetAllProcedureParameters(procedureName); - columnAccessors = new ColumnAccessors(); - for (int i = 0; headerCells != null; i++, headerCells = headerCells.More) - { - String paramName = NameNormaliser.NormaliseName(headerCells.Text); - try - { - DbParameterAccessor accessor = DbParameterAccessor.CloneWithSameParameter(allParams[paramName]); - accessor.IsBoundToCheckOperation = BindingFactory.CheckIsImpliedBy(headerCells.Text); - // sql server quirk. if output parameter is used in an input column, then - // the param should be remapped to IN/OUT - if ((!accessor.IsBoundToCheckOperation) && - accessor.DbParameter.Direction == ParameterDirection.Output) - accessor.DbParameter.Direction = ParameterDirection.InputOutput; - columnAccessors.Assign(paramName, accessor); - accessors.Add(accessor); - } - catch (KeyNotFoundException) - { - Wrong(headerCells); - throw new ApplicationException("Cannot find parameter " + paramName); - } - } - } - - public RuntimeMember Find(MemberSpecification specification) { - return columnAccessors.Find(specification, accessor => specification.MatchesIdentifierName(accessor.Key)); - } - } -} diff --git a/source/dbfit/fixture/Insert.cs b/source/dbfit/fixture/Insert.cs deleted file mode 100644 index f7a12b72..00000000 --- a/source/dbfit/fixture/Insert.cs +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright © 2012 Syterra Software Inc. Includes work Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. -// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Common; - -using fit; -using dbfit.util; -using fitSharp.Fit.Operators; -using fitSharp.Fit.Service; -using fitSharp.Machine.Engine; - -namespace dbfit.fixture { - public class Insert: ColumnFixture, MemberQueryable { - - private readonly IDbEnvironment dbEnvironment; - private IDbCommand command; - private String tableName; - - // array of parameter accessors for the input command - // this contains only those accessors that really go into input (i.e. not the primary key - // column if the database does not support return on insert. for databases that support - // return on insert, this will be the same as columnAccessors - private DbParameterAccessor[] accessors; - private ColumnAccessors columnAccessors; - private bool[] isOutputColumn; - public Insert() - { - dbEnvironment = DbEnvironmentFactory.DefaultEnvironment; - } - public Insert(IDbEnvironment dbEnvironment) - { - this.dbEnvironment=dbEnvironment; - } - public Insert(IDbEnvironment dbEnvironment, String tableName) { - this.tableName= tableName; - this.dbEnvironment = dbEnvironment; - - } - public override void DoRows(Parse rows) { - if (String.IsNullOrEmpty(tableName) && Args.Length > 0) - { - tableName = Args[0]; - } - else if (tableName == null) { - tableName=rows.Parts.Text; - rows = rows.More; - } - InitParameters(rows.Parts); - InitCommand(); - base.DoRows(rows); - } - private void InitCommand() { - String insert = dbEnvironment.BuildInsertCommand(tableName, accessors); - command = dbEnvironment.CreateCommand(insert, - CommandType.Text); - foreach (DbParameterAccessor accessor in accessors) { - command.Parameters.Add(accessor.DbParameter); - } - } - - public override void Execute() { - command.ExecuteNonQuery(); - } - - // this method will initialise accessors array from the parameters that - // really go into the insert command and columnAccessors for all columns - private void InitParameters(Parse headerCells) { - Dictionary allParams= - dbEnvironment.GetAllColumns(tableName); - columnAccessors = new ColumnAccessors(); - isOutputColumn = new bool[headerCells.Size]; - var paramAccessors=new List(); - for (int i = 0; headerCells != null; i++, headerCells = headerCells.More) { - String paramName= NameNormaliser.NormaliseName(headerCells.Text); - DbParameterAccessor currentColumn; - try - { - currentColumn = allParams[paramName]; - } - catch (KeyNotFoundException) - { - Wrong(headerCells); - throw new ApplicationException("Cannot find column " + paramName); - } - isOutputColumn[i] = BindingFactory.CheckIsImpliedBy(headerCells.Text); - currentColumn.IsBoundToCheckOperation = isOutputColumn[i]; - columnAccessors.Assign(paramName, currentColumn); - if (isOutputColumn[i]) - { - if (dbEnvironment.SupportsReturnOnInsert) - { - currentColumn.DbParameter.Direction = ParameterDirection.Output; - paramAccessors.Add(currentColumn); - } - else // don't add to paramAccessors - { - //columnAccessors.Assign(paramName, new IdRetrievalAccessor(dbEnvironment, currentColumn.DotNetType)); - columnAccessors.Assign(paramName, new IdRetrievalAccessor(dbEnvironment, currentColumn.DotNetType,tableName)); - } - } - else // not output - { - currentColumn.DbParameter.Direction = ParameterDirection.Input; - paramAccessors.Add(currentColumn); - } - } - accessors = paramAccessors.ToArray(); - } - - public RuntimeMember Find(MemberSpecification specification) { - return columnAccessors.Find(specification, accessor => specification.MatchesIdentifierName(accessor.Key)); - } - } -} diff --git a/source/dbfit/fixture/Inspect.cs b/source/dbfit/fixture/Inspect.cs deleted file mode 100644 index 72ac349b..00000000 --- a/source/dbfit/fixture/Inspect.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using dbfit.util; -using dbfit; -using fit; -using System.Data.Common; -using System.Data; -namespace dbfit.fixture -{ - public class Inspect:fit.Fixture - { - private IDbEnvironment environment; - private String objectName; - private String mode; - public static String MODE_PROCEDURE="PROCEDURE"; - public static String MODE_TABLE="TABLE"; - public static String MODE_QUERY="QUERY"; - - public Inspect() - { - this.environment = DbEnvironmentFactory.DefaultEnvironment; - } - public Inspect(IDbEnvironment dbEnvironment, String mode, String objName) { - this.objectName= objName; - this.mode=mode; - this.environment = dbEnvironment; - } - public override void DoTable(Parse table) { - if (objectName==null) objectName=Args[0]; - try{ - if (MODE_PROCEDURE.Equals(mode)) - InspectProcedure(table); - else if (MODE_TABLE.Equals(mode)) - InspectTable(table); - else if (MODE_QUERY.Equals(mode)) - InspectQuery(table); - else throw new Exception("Unknown inspect mode "+mode); - } - catch (Exception e){ - Exception(table.Parts.Parts,e); - } - } - private void InspectTable(Parse table) { - Dictionary allParams= - environment.GetAllColumns(objectName); - if (allParams.Count==0){ - throw new ApplicationException("Cannot retrieve list of columns for table or view "+objectName + " - check spelling and access rights"); - } - addRowWithParamNames(table,allParams); - } - private void InspectProcedure(Parse table) { - Dictionary allParams= - environment.GetAllProcedureParameters(objectName); - if (allParams.Count==0){ - throw new ApplicationException("Cannot retrieve list of parameters for procedure "+objectName + " - check spelling and access rights"); - } - addRowWithParamNames(table,allParams); - } - private void InspectQuery(Parse table) { - var dc = environment.CreateCommand(objectName, CommandType.Text); - environment.BindFixtureSymbols(Symbols, dc); - - DbDataAdapter oap = environment.DbProviderFactory.CreateDataAdapter(); - oap.SelectCommand = (DbCommand)dc; - DataSet ds = new DataSet(); - oap.Fill(ds); - dc.Dispose(); - DataTable dtbl=ds.Tables[0]; - - Parse newRow=getHeaderFromRS(dtbl); - table.Parts.More=newRow; - foreach (DataRow dr in dtbl.Rows){ - newRow.More = getDataRow(dr); - newRow=newRow.More; - } - - } - private Parse getDataRow(DataRow rs) { - Parse newRow=new Parse("tr",null,null,null); - Parse prevCell=null; - for (int i=0; i procparams){ - Parse newRow=new Parse("tr",null,null,null); - table.Parts.More=newRow; - Parse prevCell=null; - String[] orderedNames=new String[procparams.Count]; - foreach(String s in procparams.Keys){ - orderedNames[procparams[s].Position]=s; - } - for(int i=0; i(0), - DbEnvironmentFactory.DefaultEnvironment).Rows.GetEnumerator()); - base.DoTable(table); - } - - protected override ListMatchStrategy MatchStrategy { - get { return new QueryMatchStrategy(Processor, myHeaderRow, isOrdered); } - } - - private class QueryMatchStrategy: NamedMatchStrategy { - private readonly bool isOrdered; - public QueryMatchStrategy(CellProcessor processor, Parse theHeaderRow, bool isOrdered) - : base(processor, theHeaderRow) { - this.isOrdered = isOrdered; - } - public override bool IsOrdered {get { return isOrdered; }} - public override bool SurplusAllowed {get {return false;}} - - public override bool CellMatches(TypedValue actualValue, Tree expectedCell, int columnNumber) { - if (myHeaderRow.Branches[columnNumber].Value.Text.EndsWith("?")) return true; - if (expectedCell.Value.Text.Length == 0) return true; - return base.CellMatches(actualValue, expectedCell, columnNumber); - } - } - } -} diff --git a/source/dbfit/fixture/QueryStats.cs b/source/dbfit/fixture/QueryStats.cs deleted file mode 100644 index 57414354..00000000 --- a/source/dbfit/fixture/QueryStats.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Data; -using System.Data.Common; -namespace dbfit.fixture -{ - public class QueryStats:fit.ColumnFixture - { - private IDbEnvironment environment; - public QueryStats() - { - environment = DbEnvironmentFactory.DefaultEnvironment; - } - public QueryStats(IDbEnvironment environment) - { - this.environment = environment; - } - public string TableName; - public string ViewName { set { TableName=value;}} - public string Where; - public string Query; - private bool hasExecuted=false; - public override void Reset() - { - hasExecuted = false; - Where = null; - Query = null; - _rows = 0; - TableName = null; - } - private int _rows; - private void execQuery() - { - if (hasExecuted) return; - if (Query == null) - { - Query = "select count(*) from " + TableName + (Where != null ? " where " + Where : ""); - var dc = environment.CreateCommand(Query, CommandType.Text); - object o=dc.ExecuteScalar(); - dc.Dispose(); - if (o != null) _rows = Convert.ToInt32(o); - } - else - { - var dc = environment.CreateCommand(Query, CommandType.Text); - environment.BindFixtureSymbols(Symbols, dc); - - DbDataAdapter oap = environment.DbProviderFactory.CreateDataAdapter(); - oap.SelectCommand = (DbCommand)dc; - DataSet ds = new DataSet(); - oap.Fill(ds); - dc.Dispose(); - _rows=ds.Tables[0].Rows.Count; - } - hasExecuted = true; - } - public int RowCount() - { - execQuery(); - return _rows; - } - public bool IsEmpty() - { - return RowCount()==0; - } - } -} diff --git a/source/dbfit/fixture/SetParameter.cs b/source/dbfit/fixture/SetParameter.cs deleted file mode 100644 index 06d59bf1..00000000 --- a/source/dbfit/fixture/SetParameter.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using fitSharp.Machine.Engine; - -namespace dbfit.fixture -{ - public class SetParameter : fit.Fixture - { - public static void SetParameterValue(Symbols symbols, String name, Object value) - { - if (value == null || "null".Equals(value.ToString().ToLower())) - { - symbols.Save(name, DBNull.Value); - } - else if (value != null && value.ToString().StartsWith("<<")) - { - string varname = value.ToString().Substring(2); - if (!name.Equals(varname)) - { - symbols.Save(name, symbols.GetValueOrDefault(varname, null)); - } - } - else - symbols.Save(name, value); - } - public override void DoTable(fit.Parse table) - { - SetParameterValue(Symbols, Args[0], GetArgumentInput(1, typeof(object))); - } - } -} diff --git a/source/dbfit/fixture/SetTableParameter.cs b/source/dbfit/fixture/SetTableParameter.cs deleted file mode 100644 index 487e7838..00000000 --- a/source/dbfit/fixture/SetTableParameter.cs +++ /dev/null @@ -1,138 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Common; - -using fit; -using dbfit.util; -using fitSharp.Fit.Operators; -using fitSharp.Fit.Service; -using fitSharp.Machine.Engine; - -namespace dbfit.fixture -{ - public class SetTableParameter : ColumnFixture, MemberQueryable - { - private readonly IDbEnvironment dbEnvironment; - private String parameterTableName; - private String parameterTableType; - private Symbols symbols; - - private DbParameterAccessor[] accessors; - private ColumnAccessors columnAccessors; - private bool[] isOutputColumn; - private DataTable table; - - public SetTableParameter() - { - dbEnvironment = DbEnvironmentFactory.DefaultEnvironment; - } - public SetTableParameter(IDbEnvironment dbEnvironment) - { - this.dbEnvironment = dbEnvironment; - } - public SetTableParameter(IDbEnvironment dbEnvironment, Symbols symbols, String parameterTableName, String parameterTableType) - { - this.parameterTableName = parameterTableName; - this.parameterTableType = parameterTableType; - this.dbEnvironment = dbEnvironment; - this.symbols = symbols; - table = new DataTable(); - } - - public override void DoRows(Parse rows) - { - if (String.IsNullOrEmpty(parameterTableName) && Args.Length > 0) - { - parameterTableName = Args[0]; - } - else if (parameterTableName == null) - { - parameterTableName = rows.Parts.Text; - rows = rows.More; - } - InitParameters(rows.Parts); - - symbols.Save(parameterTableName, new TableTypeParameter(parameterTableType, table)); - - base.DoRows(rows); - } - public override void DoRow(Parse row) - { - HasExecuted = false; - try - { - Reset(); - base.DoRow(row); - if (!HasExecuted) - { - var CurrentRow = table.NewRow(); - foreach (DbParameterAccessor accessor in accessors) - { - CurrentRow[accessor.DbParameter.ParameterName] = accessor.DbParameter.Value; - } - table.Rows.Add(CurrentRow); - } - } - catch (Exception e) - { - TestStatus.MarkException(row.Leaf, e); - } - } - - // this method will initialise accessors array from the parameters that - // really go into the insert command and columnAccessors for all columns - private void InitParameters(Parse headerCells) - { - Dictionary allParams = - dbEnvironment.GetAllColumns(parameterTableType); - columnAccessors = new ColumnAccessors(); - isOutputColumn = new bool[headerCells.Size]; - var paramAccessors = new List(); - for (int i = 0; headerCells != null; i++, headerCells = headerCells.More) - { - String paramName = NameNormaliser.NormaliseName(headerCells.Text); - DbParameterAccessor currentColumn; - try - { - currentColumn = allParams[paramName]; - } - catch (KeyNotFoundException) - { - Wrong(headerCells); - throw new ApplicationException("Cannot find column " + paramName); - } - isOutputColumn[i] = BindingFactory.CheckIsImpliedBy(headerCells.Text); - currentColumn.IsBoundToCheckOperation = isOutputColumn[i]; - columnAccessors.Assign(paramName, currentColumn); - if (isOutputColumn[i]) - { - if (dbEnvironment.SupportsReturnOnInsert) - { - currentColumn.DbParameter.Direction = ParameterDirection.Output; - paramAccessors.Add(currentColumn); - } - else // don't add to paramAccessors - { - //columnAccessors.Assign(paramName, new IdRetrievalAccessor(dbEnvironment, currentColumn.DotNetType)); - columnAccessors.Assign(paramName, new IdRetrievalAccessor(dbEnvironment, currentColumn.DotNetType, parameterTableType)); - } - } - else // not output - { - currentColumn.DbParameter.Direction = ParameterDirection.Input; - paramAccessors.Add(currentColumn); - } - - table.Columns.Add(currentColumn.DbFieldName, currentColumn.DotNetType); - } - accessors = paramAccessors.ToArray(); - } - - public RuntimeMember Find(MemberSpecification specification) - { - return columnAccessors.Find(specification, accessor => specification.MatchesIdentifierName(accessor.Key)); - } - - } -} diff --git a/source/dbfit/fixture/StoreQuery.cs b/source/dbfit/fixture/StoreQuery.cs deleted file mode 100644 index 1d4d2b53..00000000 --- a/source/dbfit/fixture/StoreQuery.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using fit; -using fitSharp.Fit.Model; -using fitSharp.Machine.Model; - -namespace dbfit.fixture -{ - public class StoreQuery:fit.Fixture - { - private IDbEnvironment dbEnvironment; - private String query; - private String symbolName; - public StoreQuery() - { - dbEnvironment = DbEnvironmentFactory.DefaultEnvironment; - } - public StoreQuery(IDbEnvironment environment, String query, String symbolName) - { - this.dbEnvironment = environment; - this.query = query; - this.symbolName = symbolName; - } - - public override void DoTable(Parse table) - { - if (query == null || symbolName == null) - { - if (Args.Length < 2) throw new ApplicationException("No query and symbol name specified to StoreQuery constructor or argument list"); - query = Args[0]; - symbolName = Args[1]; - } - if (symbolName.StartsWith(">>")) symbolName = symbolName.Substring(2); - Symbols.Save(symbolName, DatabaseTest.GetDataTable(Symbols, query,dbEnvironment)); - } - - } -} diff --git a/source/dbfit/fixture/Update.cs b/source/dbfit/fixture/Update.cs deleted file mode 100644 index 0439c31d..00000000 --- a/source/dbfit/fixture/Update.cs +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright © 2012 Syterra Software Inc. Includes work Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. -// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Common; -using dbfit.util; -using fit; -using fitSharp.Fit.Operators; -using fitSharp.Machine.Engine; - -namespace dbfit.fixture { - public class Update: ColumnFixture, MemberQueryable { - private readonly IDbEnvironment dbEnvironment; - private IDbCommand command; - private String tableName; - private DbParameterAccessor[] updateAccessors; - private DbParameterAccessor[] selectAccessors; - private ColumnAccessors columnAccessors; - private Parse headerCells; - private Parse currentHeader; - - public Update(){ - dbEnvironment = DbEnvironmentFactory.DefaultEnvironment; - } - public Update(IDbEnvironment dbEnvironment){ - this.dbEnvironment=dbEnvironment; - } - public Update(IDbEnvironment dbEnvironment, String tableName){ - this.tableName= tableName; - this.dbEnvironment = dbEnvironment; - } - public override void DoRows(Parse rows) { - if (String.IsNullOrEmpty(tableName) && Args.Length > 0){ - tableName = Args[0]; - } - else if (tableName == null) { - tableName=rows.Parts.Text; - rows = rows.More; - } - InitParameters(rows.Parts); - InitCommand(); - headerCells = rows.Parts; - base.DoRows(rows); - } - - public override void DoCell(Parse cell, int column) { - currentHeader = headerCells.At(column); - base.DoCell(cell, column); - } - - private void InitCommand() { - String ctext=dbEnvironment.BuildUpdateCommand(tableName,updateAccessors,selectAccessors); - command = dbEnvironment.CreateCommand(ctext,CommandType.Text); - foreach (DbParameterAccessor accessor in updateAccessors) { - command.Parameters.Add(accessor.DbParameter); - } - foreach (DbParameterAccessor accessor in selectAccessors) - { - command.Parameters.Add(accessor.DbParameter); - } - } - - public override void Execute() { - command.ExecuteNonQuery(); - } - - private void InitParameters(Parse headerCells) { - Dictionary allParams= - dbEnvironment.GetAllColumns(tableName); - - columnAccessors = new ColumnAccessors(); - IList selectAccList=new List(); - IList updateAccList = new List(); - for (int i = 0; headerCells != null; i++, headerCells = headerCells.More) - { - String paramName= NameNormaliser.NormaliseName(headerCells.Text); - try - { - DbParameterAccessor acc = allParams[paramName]; - acc.DbParameter.Direction = ParameterDirection.Input; - // allow same column to be used in both sides: - // remap update parameters to u_paramname and select to s_paramname - acc = DbParameterAccessor.Clone(acc, dbEnvironment); - if (headerCells.Text.EndsWith("=")) - { - acc.DbParameter.ParameterName = acc.DbParameter.ParameterName+"_u"; - updateAccList.Add(acc); - columnAccessors.Assign(paramName +"=", acc); - } - else - { - acc.DbParameter.ParameterName = acc.DbParameter.ParameterName+"_s"; - selectAccList.Add(acc); - columnAccessors.Assign(paramName, acc); - } - } - catch (KeyNotFoundException) - { - Wrong(headerCells); - throw new ApplicationException("Cannot find column for " + paramName); - } - } - selectAccessors=new DbParameterAccessor[selectAccList.Count]; - selectAccList.CopyTo(selectAccessors,0); - updateAccessors = new DbParameterAccessor[updateAccList.Count]; - updateAccList.CopyTo(updateAccessors, 0); - } - - public RuntimeMember Find(MemberSpecification specification) { - return columnAccessors.Find(specification, accessor => { - var accessorName = accessor.Key.EndsWith("=") - ? accessor.Key.Substring(0, accessor.Key.Length - 1) - : accessor.Key; - if (!specification.MatchesIdentifierName(accessorName)) return false; - if (currentHeader != null && currentHeader.Text.EndsWith("=") && !accessor.Key.EndsWith("=")) return false; - if (currentHeader != null && !currentHeader.Text.EndsWith("=") && accessor.Key.EndsWith("=")) return false; - return true; - }); - } - } -} diff --git a/source/dbfit/util/Accessor.cs b/source/dbfit/util/Accessor.cs deleted file mode 100644 index 9482e94f..00000000 --- a/source/dbfit/util/Accessor.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright © 2010 Syterra Software Inc. Includes work Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. -// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -using System; - -namespace dbfit.util { - public interface Accessor { - object Get(); - void Set(object value); - Type DotNetType { get; } - string Name { get; } - } -} diff --git a/source/dbfit/util/ColumnAccessors.cs b/source/dbfit/util/ColumnAccessors.cs deleted file mode 100644 index bab5d445..00000000 --- a/source/dbfit/util/ColumnAccessors.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright © 2012 Syterra Software Inc. Includes work Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. -// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -using System; -using System.Collections.Generic; -using fitSharp.Machine.Engine; -using fitSharp.Machine.Model; - -namespace dbfit.util { - public class ColumnAccessors { - private readonly Dictionary accessors = new Dictionary(); - - public void Assign(string key, Accessor accessor) { - accessors[key] = accessor; - } - - public RuntimeMember Find(MemberSpecification specification, Func, bool> filter) { - foreach (KeyValuePair accessor in accessors) { - if (!filter(accessor)) continue; - if (specification.IsSetter) return new SetterMember(accessor.Value); - if (specification.IsGetter) return new GetterMember(accessor.Value); - } - throw new ArgumentException(string.Format("Missing member '{0}'", specification)); - } - - private class SetterMember: RuntimeMember { - private readonly Accessor accessor; - - public SetterMember(Accessor accessor) { - this.accessor = accessor; - } - - public TypedValue Invoke(object[] parameters) { - accessor.Set(parameters[0]); - return TypedValue.Void; - } - - public bool MatchesParameterCount(int count) { - return count == 1; - } - - public Type GetParameterType(int index) { - return accessor.DotNetType; - } - - public string GetParameterName(int index) { - return accessor.Name; - } - - public Type ReturnType { - get { return typeof(void); } - } - - public string Name { - get { return accessor.Name; } - } - } - - private class GetterMember: RuntimeMember { - private readonly Accessor accessor; - - public GetterMember(Accessor accessor) { - this.accessor = accessor; - } - - public TypedValue Invoke(object[] parameters) { - return new TypedValue(accessor.Get(), accessor.DotNetType); - } - - public bool MatchesParameterCount(int count) { - return count == 0; - } - - public Type GetParameterType(int index) { - return typeof(void); - } - - public string GetParameterName(int index) { - return accessor.Name; - } - - public Type ReturnType { - get { return accessor.DotNetType; } - } - - public string Name { - get { return accessor.Name; } - } - } - } -} diff --git a/source/dbfit/util/ColumnMissingException.cs b/source/dbfit/util/ColumnMissingException.cs deleted file mode 100644 index 453c4723..00000000 --- a/source/dbfit/util/ColumnMissingException.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright © 2010 Syterra Software Inc. Includes work Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. -// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -using System; - -namespace dbfit { - public class ColumnMissingException : ApplicationException { - public ColumnMissingException(String name) : base("Cannot find column " + name) { } - } -} diff --git a/source/dbfit/util/DbConnectionProperties.cs b/source/dbfit/util/DbConnectionProperties.cs deleted file mode 100644 index 040e5137..00000000 --- a/source/dbfit/util/DbConnectionProperties.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - - -namespace dbfit -{ - public sealed class DbConnectionProperties{ - public string Service; - public string Username; - public string Password; - public string DbName; - public string FullConnectionString; - private DbConnectionProperties(){} - public static DbConnectionProperties CreateFromString(String contents) - { - int currLine=0; - String[] lines = contents.Split(new char[]{'\n'}); - DbConnectionProperties props = new DbConnectionProperties(); - foreach (String line in lines) - { - currLine++; - if (line==null) continue; - String trimline=line.Trim(); - if (trimline.Length == 0) continue; - if (trimline.StartsWith("#")) continue; - String[] keyval = trimline.Split(new char[] { '=' },2); - if (keyval.Length==1) throw new - ApplicationException("Connection properties format incorrect, line "+currLine+ " does not contain a key-value pair "); - String key = keyval[0].Trim().ToLower(); - String val = keyval[1].Trim(); - if ("username".Equals(key)) - { - props.Username = val; - } - else if ("password".Equals(key)) - { - props.Password = val; - } - else if ("service".Equals(key)) - { - props.Service = val; - } - else if ("database".Equals(key)) - { - props.DbName = val; - } - else if ("connection-string".Equals(key)) - { - props.FullConnectionString = val; - } - else - { - throw new ApplicationException("Unsupported key in properties file:" + key); - } - - } - if (props.FullConnectionString != null) return props; - if (props.Service != null && props.Username != null && props.Password != null) return props; - throw new ApplicationException("You have to define either the full connection string; or service, username and password in the properties file"); - } - public static DbConnectionProperties CreateFromFile(String path){ - if(!System.IO.File.Exists(path)) throw new ApplicationException("File "+path +" does not exist"); - String s; - try{ - s=System.IO.File.ReadAllText(path); - } - catch (Exception e){ - throw new ApplicationException("Error reading file "+path,e); - } - return CreateFromString(s); - } - } -} \ No newline at end of file diff --git a/source/dbfit/util/DbParameterAccessor.cs b/source/dbfit/util/DbParameterAccessor.cs deleted file mode 100644 index ee715d3a..00000000 --- a/source/dbfit/util/DbParameterAccessor.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Common; -using dbfit.util; -using fit; - -namespace dbfit { - public class DbParameterAccessor : Accessor { - private DbParameter dbp; - private String actualSqlType; - private Type dotNetType; - private String dbFieldName;// this can be used when parameter name in SQL should differ from the data field name - private bool isBoundToCheckOperation = false; - private int position; - public int Position - { - get { return position; } - } - public String ActualSqlType - { - get { return actualSqlType; } - } - public Type DotNetType - { - get { return dotNetType;} - } - - public string Name { - get { return DbParameter.ParameterName; } - } - - public DbParameter DbParameter - { - get { return dbp; } - internal set { dbp = value; } - } - public String DbFieldName { - get { return dbFieldName; } - } - public bool IsBoundToCheckOperation - { - get { return isBoundToCheckOperation; } - internal set { isBoundToCheckOperation = value; } - } - public static DbParameterAccessor Clone(DbParameterAccessor dbacc, IDbEnvironment environment) - { - DbParameter cloneP=environment.DbProviderFactory.CreateParameter(); - cloneP.ParameterName=dbacc.DbParameter.ParameterName; - cloneP.DbType= dbacc.DbParameter.DbType; - cloneP.Direction= dbacc.DbParameter.Direction; - cloneP.Size= dbacc.DbParameter.Size; - cloneP.SourceColumn = dbacc.DbParameter.SourceColumn; - cloneP.Value=dbacc.DbParameter.Value; - DbParameterAccessor clone=new DbParameterAccessor(cloneP, dbacc.dotNetType,dbacc.position, dbacc.actualSqlType); - clone.dbFieldName=dbacc.dbFieldName; - clone.isBoundToCheckOperation=dbacc.isBoundToCheckOperation; - return clone; - } - public static DbParameterAccessor CloneWithSameParameter(DbParameterAccessor dbacc) - { - DbParameterAccessor clone = new DbParameterAccessor(dbacc.DbParameter, dbacc.dotNetType, dbacc.position, dbacc.actualSqlType); - clone.dbFieldName = dbacc.dbFieldName; - clone.isBoundToCheckOperation = dbacc.isBoundToCheckOperation; - return clone; - } - - public DbParameterAccessor(DbParameter dbp, Type dotNetType, int position, String actualSqlType) - { - this.dbp = dbp; - this.dotNetType = dotNetType; - this.dbFieldName=dbp.ParameterName; - this.position = position; - this.actualSqlType = actualSqlType; - } - public object Get() { - if (ParameterDirection.Input.Equals(dbp.Direction)) - throw new NotSupportedException("Cannot use input parameters as output values. Please remove the question mark after " + dbp.ParameterName); - if (typeof(DataTable).Equals(dotNetType) && (dbp.Value is DbDataReader)) { - DataTable dt=new DataTable(); - dt.Load((DbDataReader) dbp.Value); - return dt; - } - return dbp.Value; - } - public void Set(object value) { - if (ParameterDirection.Input.Equals(dbp.Direction) - || - ParameterDirection.InputOutput.Equals(dbp.Direction)) - dbp.Value = value==null?DBNull.Value:value; - else - throw new NotSupportedException("Cannot use output parameters as input values. Did you forget a question mark after " + dbp.ParameterName); - - } - } -} diff --git a/source/dbfit/util/IdRetrievalAccessor.cs b/source/dbfit/util/IdRetrievalAccessor.cs deleted file mode 100644 index bfe3f11c..00000000 --- a/source/dbfit/util/IdRetrievalAccessor.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Data.Common; -using System.Data; -namespace dbfit.util -{ - public class IdRetrievalAccessor: Accessor - { - private IDbEnvironment environment; - private Type expectedType; - private String tableName; - public IdRetrievalAccessor(IDbEnvironment environment, Type expectedType) - { - this.environment = environment; - this.expectedType = expectedType; - } - public IdRetrievalAccessor(IDbEnvironment environment, Type expectedType, String tableName) - { - this.environment = environment; - this.expectedType = expectedType; - this.tableName = tableName; - } - public object Get() - { - if (environment.SupportsReturnOnInsert) - throw new ApplicationException(environment.GetType() + - " supports return on insert, IdRetrievalAccessor should not be used"); - var cmd = environment.CreateCommand(environment.IdentitySelectStatement(tableName), CommandType.Text); - // Console.WriteLine(environment.IdentitySelectExpression); - object value = cmd.ExecuteScalar(); - value=Convert.ChangeType(value, expectedType); - //Console.WriteLine("value=" + value + " of " + value.GetType()); - return (DBNull.Value.Equals(value) ? null : value); - } - public void Set(object value) - { - } - - public Type DotNetType { - get { return expectedType; } - } - - public string Name { - get { return string.Empty; } - } - } -} diff --git a/source/dbfit/util/NameNormaliser.cs b/source/dbfit/util/NameNormaliser.cs deleted file mode 100644 index 46cd6d70..00000000 --- a/source/dbfit/util/NameNormaliser.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; - -namespace dbfit.util { - public class NameNormaliser { - private static Regex replaceIllegalCharactersWithSpacesRegex = new Regex(@"[^a-zA-Z0-9_.#]"); - private static string ReplaceIllegalCharacters(string name) { - return replaceIllegalCharactersWithSpacesRegex.Replace(name, ""); - } - public static String NormaliseName(String name) { - if (name == null) return ""; - return ReplaceIllegalCharacters(name.ToLower()); - } - } -} diff --git a/source/dbfit/util/Options.cs b/source/dbfit/util/Options.cs deleted file mode 100644 index 03cf4b63..00000000 --- a/source/dbfit/util/Options.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright © 2010 Syterra Software Inc. Includes work Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. -// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -using System; -using fitSharp.Fit.Engine; -using fitSharp.Fit.Operators; - -namespace dbfit.util -{ - public class Options - { - private static bool fixedLengthStringParsing; - private static bool bindSymbols = true; - private static int commandTimeOut = 30; - - public static void reset() - { - fixedLengthStringParsing = false; - bindSymbols = true; - commandTimeOut = 30; - } - public static bool IsFixedLengthStringParsing() - { - return fixedLengthStringParsing; - } - public static bool ShouldBindSymbols() - { - return bindSymbols; - } - public static int CommandTimeOut { get { return commandTimeOut; } } - - public static void SetOption(CellProcessor processor, String name, String value) - { - String normalname = NameNormaliser.NormaliseName(name); - if ("fixedlengthstringparsing".Equals(normalname)) - { - fixedLengthStringParsing = Boolean.Parse(value); - if (fixedLengthStringParsing) - processor.AddOperator(typeof(ParseQuotedString).FullName); - else - processor.RemoveOperator(typeof(ParseQuotedString).FullName); - } - else if ("bindsymbols".Equals(normalname)) - { - bindSymbols = Boolean.Parse(value); - } - else if (normalname == "commandtimeout") - { - commandTimeOut = int.Parse(value); - } - else throw new ApplicationException("Unsupported option" + name); - } - } -} diff --git a/source/dbfit/util/TableTypeParameter.cs b/source/dbfit/util/TableTypeParameter.cs deleted file mode 100644 index 0d418ac6..00000000 --- a/source/dbfit/util/TableTypeParameter.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Data; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace dbfit.util -{ - public class TableTypeParameter - { - String _tabletype; - DataTable _datatable; - - public TableTypeParameter(String tabletype, DataTable datatable) - { - _tabletype = tabletype; - _datatable = datatable; - } - - public String Tabletype { get { return _tabletype; } } - - public DataTable Datatable { get { return _datatable; } } - - } -} diff --git a/source/dbfitMySql/MySqlEnvironment.cs b/source/dbfitMySql/MySqlEnvironment.cs deleted file mode 100644 index 4e7810e2..00000000 --- a/source/dbfitMySql/MySqlEnvironment.cs +++ /dev/null @@ -1,268 +0,0 @@ -// Copyright © 2011 Ed Harper Includes work Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. -// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Common; -using System.Text; -using MySql.Data.Types; -using MySql.Data.MySqlClient; -using System.Text.RegularExpressions; -using dbfit.util; - -namespace dbfit -{ - /// - /// Implementation of IDbEnvironment that works with MySql - /// - public class MySqlEnvironment : AbstractDbEnvironment - { - private const int MAX_STRING_SIZE = 65535; - protected override String GetConnectionString(String dataSource, String username, String password, String databaseName) - { - return String.Format("data source={0};user id={1};password={2};database={3};", dataSource, username, password, databaseName); - } - - protected override String GetConnectionString(String dataSource, String username, String password) - { - return String.Format("Data Source={0}; User ID={1}; Password={2}", dataSource, username, password); - } - private static readonly DbProviderFactory dbp = DbProviderFactories.GetFactory("MySql.Data.MySqlClient"); - private readonly Regex paramNames = new Regex("@([A-Za-z0-9_]*)"); - private readonly Regex multispaces = new Regex("\\s+"); - protected override Regex ParamNameRegex { get { return paramNames; } } - - public override DbProviderFactory DbProviderFactory - { - get { return dbp; } - } - public override Dictionary GetAllProcedureParameters(String procName) //done - { - String[] qualifiers = NameNormaliser.NormaliseName(procName).Split('.'); - String qry = " select type,param_list,returns from mysql.proc where "; - if (qualifiers.Length == 2) - { - qry += " lower(db)=@schema and lower(name)=@objname "; - } - else - { - qry += " (db=database() and lower(name)=@objname)"; - } - //Console.WriteLine(qry); - Dictionary res = ProcedureReadIntoParams(qualifiers, qry); - if (res.Count == 0) throw new ApplicationException("Cannot read list of parameters for " + procName + " - check spelling and access privileges"); - return res; - } - public override Dictionary GetAllColumns(String tableOrViewName) //done - { - String[] qualifiers = NameNormaliser.NormaliseName(tableOrViewName).Split('.'); - String qry = @" select column_name, data_type, character_maximum_length, 'IN' as direction from information_schema.columns where "; - if (qualifiers.Length == 2) - { - qry += " lower(table_schema)=@schema and lower(table_name)=@objname "; - } - else - { - qry += @" (table_schema=database() and lower(table_name)=@objname)"; - } - qry += " order by ordinal_position "; - //Console.WriteLine(qry); - Dictionary res = ReadIntoParams(qualifiers, qry); - if (res.Count == 0) throw new ApplicationException("Cannot read list of columns for " + tableOrViewName + " - check spelling and access privileges"); - return res; - } - - - private Dictionary ProcedureReadIntoParams(String[] queryParameters, String query) //done - { - var reader = ExecuteParameterQuery(queryParameters, query); - Dictionary - allParams = new Dictionary(); - reader.Read(); - String procType = (reader.IsDBNull(0)) ? null : reader.GetString(0); - String paramList = multispaces.Replace(reader.GetString(1)," "); - String returns = reader.GetString(2); - reader.Close(); - int position = 0; - foreach (string param in paramList.Split(',')) - { - string[] tokens = param.Trim().ToLower().Split(new char[] { ' ' , '(' , ')' }); - int i = 0; - string direction = ""; - string paramName = ""; - string dataType = ""; - int length = 0; - - if (tokens[i].Equals("in") || tokens[i].Equals("out") || tokens[i].Equals("inout")) - { - direction = tokens[i]; - i++; - } - else - { - direction = "in"; - } - paramName = tokens[i]; - i++; - dataType = tokens[i]; - i++; - - if (i <= tokens.Length -1 && !Int32.TryParse(tokens[i],out length)) - { - length = 0; - } - - MySqlParameter dp = BuildMySqlParameter(direction, paramName, dataType, length); - allParams[NameNormaliser.NormaliseName(paramName)] = - new DbParameterAccessor(dp, GetDotNetType(dataType), position++, dataType); - } - if(procType.Equals("FUNCTION")) - { - string[] tokens = returns.Trim().ToLower().Split(new char[] { ' ', '(', ')' }); - string paramName = "?"; - string dataType = tokens[0]; - MySqlParameter dp = BuildMySqlParameter("return", paramName, dataType, -1); - allParams[NameNormaliser.NormaliseName(paramName)] = - new DbParameterAccessor(dp, GetDotNetType(dataType), position++, dataType); - } - return allParams; - } - - private static MySqlParameter BuildMySqlParameter(string direction, string paramName, string dataType, int length) - { - MySqlParameter dp = new MySqlParameter(); - dp.Direction = GetParameterDirection(direction); - if (paramName != null) - { - dp.ParameterName = paramName; dp.SourceColumn = paramName; - } - else - { - dp.Direction = ParameterDirection.ReturnValue; - } - - dp.MySqlDbType = GetDBType(dataType); - if (length > 0) - { - dp.Size = length; - } - else - { - if (!ParameterDirection.Input.Equals(dp.Direction) || typeof(String).Equals(GetDotNetType(dataType))) dp.Size = MAX_STRING_SIZE; - } - return dp; - } - - private Dictionary ReadIntoParams(String[] queryParameters, String query) //done - { - var reader = ExecuteParameterQuery(queryParameters, query); - Dictionary - allParams = new Dictionary(); - int position = 0; - while (reader.Read()) - { - - String paramName = (reader.IsDBNull(0)) ? null : reader.GetString(0); - String dataType = reader.GetString(1); - int length = (reader.IsDBNull(2)) ? 0 : reader.GetInt32(2); - String direction = reader.GetString(3); - MySqlParameter dp = BuildMySqlParameter(direction, paramName, dataType, length); - allParams[NameNormaliser.NormaliseName(paramName)] = - new DbParameterAccessor(dp, GetDotNetType(dataType), position++, dataType); - } - reader.Close(); - return allParams; - } - - private IDataReader ExecuteParameterQuery(String[] queryParameters, String query) - { - var cnx = CurrentConnection; - var dc = cnx.CreateCommand(); - dc.Transaction = (DbTransaction)CurrentTransaction; - dc.CommandText = query; - dc.CommandType = CommandType.Text; - if (queryParameters.Length == 2) - { - AddInput(dc, "@schema", queryParameters[0]); - AddInput(dc, "@objname", queryParameters[1]); - } - else - { - AddInput(dc, "@objname", queryParameters[0]); - } - var reader = dc.ExecuteReader(); - return reader; - } - //datatypes done - private static string[] StringTypes = new string[] { "VARCHAR", "CHAR", "TEXT" }; - private static string[] IntTypes = new string[] { "TINYINT", "SMALLINT", "MEDIUMINT", "INT", "INTEGER" }; - private static string[] LongTypes = new string[] { "BIGINT", "INTEGER UNSIGNED", "INT UNSIGNED" }; - private static string[] FloatTypes = new string[] { "FLOAT" }; - private static string[] DoubleTypes = new string[] { "DOUBLE" }; - private static string[] DecimalTypes = new string[] { "DECIMAL", "DEC" }; - private static string[] DateTypes = new string[] { "DATE" }; - private static string[] TimestampTypes = new string[] { "TIMESTAMP", "DATETIME" }; - //\done - - private static string NormaliseTypeName(string dataType) //done - { - dataType = dataType.ToUpper().Trim(); - return dataType; - } - private static MySqlDbType GetDBType(String dataType) //done - { - //todo:strip everything from first blank - dataType = NormaliseTypeName(dataType); - - if (Array.IndexOf(StringTypes, dataType) >= 0) return MySqlDbType.VarChar; - if (Array.IndexOf(IntTypes, dataType) >= 0) return MySqlDbType.Int32; - if (Array.IndexOf(LongTypes, dataType) >= 0) return MySqlDbType.Int64; - if (Array.IndexOf(FloatTypes, dataType) >= 0) return MySqlDbType.Float; - if (Array.IndexOf(DoubleTypes, dataType) >= 0) return MySqlDbType.Double; - if (Array.IndexOf(DecimalTypes, dataType) >= 0) return MySqlDbType.Decimal; - if (Array.IndexOf(DateTypes, dataType) >= 0) return MySqlDbType.Date; - if (Array.IndexOf(TimestampTypes, dataType) >= 0) return MySqlDbType.DateTime; - throw new NotSupportedException("Type " + dataType + " is not supported"); - } - private static Type GetDotNetType(String dataType) //done - { - dataType = NormaliseTypeName(dataType); - if (Array.IndexOf(StringTypes, dataType) >= 0) return typeof(string); - if (Array.IndexOf(IntTypes, dataType) >= 0) return typeof(Int32); - if (Array.IndexOf(LongTypes, dataType) >= 0) return typeof(long); - if (Array.IndexOf(FloatTypes, dataType) >= 0) return typeof(float); - if (Array.IndexOf(DoubleTypes, dataType) >= 0) return typeof(double); - if (Array.IndexOf(DecimalTypes, dataType) >= 0) return typeof(decimal); - if (Array.IndexOf(DateTypes, dataType) >= 0) return typeof(DateTime); - if (Array.IndexOf(TimestampTypes, dataType) >= 0) return typeof(DateTime); - throw new NotSupportedException("Type " + dataType + " is not supported"); - } - private static ParameterDirection GetParameterDirection(String direction) - { - if ("in".Equals(direction.ToLower())) return ParameterDirection.Input; - if ("out".Equals(direction.ToLower())) return ParameterDirection.Output; - if ("inout".Equals(direction.ToLower())) return ParameterDirection.InputOutput; - if ("return".Equals(direction.ToLower())) return ParameterDirection.ReturnValue; - throw new NotSupportedException("Direction " + direction + " is not supported"); - } - - public override int GetExceptionCode(Exception dbException) //done - { - if (dbException is MySql.Data.MySqlClient.MySqlException) - return ((MySql.Data.MySqlClient.MySqlException)dbException).ErrorCode; - else if (dbException is System.Data.Common.DbException) - return ((System.Data.Common.DbException)dbException).ErrorCode; - else return 0; - } - public override String ParameterPrefix //done - { - get { return "@"; } - } - public override bool SupportsReturnOnInsert { get { return false; } } //done - public override String IdentitySelectStatement(string tableName) { return "select last_insert_id();"; } //done - - } -} diff --git a/source/dbfitMySql/MySqlTest.cs b/source/dbfitMySql/MySqlTest.cs deleted file mode 100644 index fb33a00e..00000000 --- a/source/dbfitMySql/MySqlTest.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace dbfit -{ - public class MySqlTest : DatabaseTest - { - public MySqlTest() - : base(new MySqlEnvironment()) - { - - } - } -} diff --git a/source/dbfitMySql/Properties/AssemblyInfo.cs b/source/dbfitMySql/Properties/AssemblyInfo.cs deleted file mode 100644 index 725351ad..00000000 --- a/source/dbfitMySql/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("DbFit MySql for fitSharp")] -[assembly: AssemblyDescription("DbFit. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2.")] -[assembly: AssemblyProduct("fitSharp")] -[assembly: ComVisible(false)] - -[assembly: AssemblyCopyright("Copyright © 2022 Syterra Software Inc. All rights reserved.")] -[assembly: AssemblyVersion("2022.1.15.0")] diff --git a/source/dbfitMySql/dbfitMySql.csproj b/source/dbfitMySql/dbfitMySql.csproj deleted file mode 100644 index cda10cc1..00000000 --- a/source/dbfitMySql/dbfitMySql.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - net48;net6.0;net6.0-windows;net7.0;net7.0-windows;net8.0;net8.0-windows - dbfit.MySql - dbfit.MySql - false - false - - - - - - - - - - \ No newline at end of file diff --git a/source/dbfitOracle/OracleEnvironment.cs b/source/dbfitOracle/OracleEnvironment.cs deleted file mode 100644 index 8ac28f5f..00000000 --- a/source/dbfitOracle/OracleEnvironment.cs +++ /dev/null @@ -1,217 +0,0 @@ -/// Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -/// Released under GNU GPL 2.0 -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Common; -using System.Data.OracleClient; -using System.Text.RegularExpressions; -using System.Xml; -using System.Text; -using dbfit.util; -namespace dbfit { -/// -/// Implementation of IDbEnvironment that uses Microsoft's ADO.NET driver for Oracle -/// - - public class OracleEnvironment : AbstractDbEnvironment { - protected override String GetConnectionString(String dataSource, String username, String password) - { - return String.Format("Data Source={0}; User ID={1}; Password={2}",dataSource,username,password); - } - protected override String GetConnectionString(String dataSource, String username, String password, String databaseName) - { - return String.Format("Data Source={0}/{3}; User ID={1}; Password={2}", dataSource, username, password,databaseName); - } - private Regex paramNames = new Regex(":([A-Za-z0-9_]+)"); - protected override Regex ParamNameRegex { get { return paramNames; } } - - private static DbProviderFactory dbp = DbProviderFactories.GetFactory("System.Data.OracleClient"); - public override DbProviderFactory DbProviderFactory - { - get { return dbp; } - } - public override Dictionary GetAllProcedureParameters(String procName) - { - String[] qualifiers = NameNormaliser.NormaliseName(procName).Split('.'); - String cols = " argument_name, data_type, data_length, IN_OUT, sequence "; - String qry = @" select " + cols + " from all_arguments where data_level=0 and "; - if (qualifiers.Length == 3) { - qry += " owner=:0 and package_name=:1 and object_name=:2 "; - } else if (qualifiers.Length == 2) { - qry += @" ((owner=:0 and package_name is null and object_name=:1) or - (owner=user and package_name=:0 and object_name=:1))"; - } else { - qry += @" - (owner=user and package_name is null and object_name=:0)"; - } - // map to public synonyms also - if (qualifiers.Length<3){ - qry+=@" union all - select " +cols+@" from all_arguments, all_synonyms - where data_level=0 and all_synonyms.owner='PUBLIC' and all_arguments.owner=table_owner and "; - if (qualifiers.Length==2){ // package - qry+=" package_name=table_name and synonym_name=:0 and object_name=:1 "; - } - else { - qry+=" package_name is null and object_name=table_name and synonym_name=:0 "; - } - } - qry+=" order by sequence "; - //Console.WriteLine(qry); - Dictionary res=ReadIntoParams(qualifiers, qry); - if (res.Count == 0) throw new ApplicationException("Cannot read list of parameters for " + procName + " - check spelling and access privileges"); - return res; - } - public override Dictionary GetAllColumns(String tableOrViewName) - { - String[] qualifiers = NameNormaliser.NormaliseName(tableOrViewName).Split('.'); - String qry = @" select column_name, data_type, data_length, - 'IN' as direction, column_id from all_tab_columns where "; - if (qualifiers.Length == 2) { - qry += " owner=:0 and table_name=:1 "; - } else { - qry += @" - (owner=user and table_name=:0)"; - } - qry += " order by column_id "; - Dictionary res = ReadIntoParams(qualifiers, qry); - if (res.Count == 0) throw new ApplicationException("Cannot read list of columns for " + tableOrViewName + " - check spelling and access privileges"); - return res; - } - - private Dictionary ReadIntoParams(String[] queryParameters, String query) { - var cnx = CurrentConnection; - var dc = cnx.CreateCommand(); - dc.Transaction = (DbTransaction)CurrentTransaction; - dc.CommandText = query; - dc.CommandType = CommandType.Text; - for (int i = 0; i < queryParameters.Length; i++) { - AddInput(dc, ":" + i, queryParameters[i].ToUpper()); - } - var reader = dc.ExecuteReader(); - Dictionary - allParams = new Dictionary(); - int position = 0; - while (reader.Read()) { - - String paramName = (reader.IsDBNull(0)) ? null : reader.GetString(0); - String dataType = reader.GetString(1); - int length = (reader.IsDBNull(2)) ? 0 : reader.GetInt32(2); - String direction = reader.GetString(3); - OracleParameter dp = new OracleParameter(); - dp.Direction = GetParameterDirection(direction); - if (paramName != null) { - dp.ParameterName = paramName; dp.SourceColumn=paramName; - } - else { - dp.Direction = ParameterDirection.ReturnValue; - } - - dp.OracleType = GetDBType(dataType); - if (length > 0) { - dp.Size = length; - - } else { - if (!ParameterDirection.Input.Equals(dp.Direction) || typeof(String).Equals(GetDotNetType(dataType))) - dp.Size = 4000; - } - allParams[NameNormaliser.NormaliseName(paramName)] = - new DbParameterAccessor(dp, GetDotNetType(dataType), position++, dataType); - } - return allParams; - } - private static string[] StringTypes = new string[] { "VARCHAR", "VARCHAR2", "NVARCHAR2", "CHAR", "NCHAR", "ROWID", "CLOB", "NCLOB", "RAW" }; - private static string[] DecimalTypes = new string[] { "BINARY_INTEGER","NUMBER","FLOAT" }; - private static string[] DateTypes = new string[] { "TIMESTAMP", "DATE" }; - private static string[] RefCursorTypes = new string[] { "REF" }; - - private static string NormaliseTypeName(string dataType) { - dataType = dataType.ToUpper().Trim(); - int idx = dataType.IndexOf(" "); - if (idx >= 0) dataType = dataType.Substring(0, idx); - idx = dataType.IndexOf("("); - if (idx >= 0) dataType = dataType.Substring(0, idx); - return dataType; - } - private static OracleType GetDBType(String dataType) { - //todo:strip everything from first blank - dataType = NormaliseTypeName(dataType); - - if (Array.IndexOf(StringTypes, dataType) >= 0) return OracleType.VarChar; - if (Array.IndexOf(DecimalTypes, dataType) >= 0) return OracleType.Number; - if (Array.IndexOf(DateTypes, dataType) >= 0) return OracleType.DateTime; - if (Array.IndexOf(RefCursorTypes, dataType) >= 0) return OracleType.Cursor; - throw new NotSupportedException("Type " + dataType + " is not supported"); - } - private static Type GetDotNetType(String dataType) { - dataType = NormaliseTypeName(dataType); - if (Array.IndexOf(StringTypes, dataType) >= 0) return typeof(string); - if (Array.IndexOf(DecimalTypes, dataType) >= 0) return typeof(decimal); - if (Array.IndexOf(DateTypes, dataType) >= 0) return typeof(DateTime); - if (Array.IndexOf(RefCursorTypes, dataType) >= 0) return typeof(DataTable); - - throw new NotSupportedException("Type " + dataType + " is not supported"); - } - private static ParameterDirection GetParameterDirection(String direction) { - if ("IN".Equals(direction)) return ParameterDirection.Input; - if ("OUT".Equals(direction)) return ParameterDirection.Output; - if ("IN/OUT".Equals(direction)) return ParameterDirection.InputOutput; - //todo return val - throw new NotSupportedException("Direction " + direction + " is not supported"); - } - public override String BuildInsertCommand(String tableName, DbParameterAccessor[] accessors) - { - StringBuilder sb = new StringBuilder("insert into "); - sb.Append(tableName).Append("("); - String comma = ""; - String retComma = ""; - - StringBuilder values = new StringBuilder(); - StringBuilder retNames = new StringBuilder(); - StringBuilder retValues = new StringBuilder(); - - foreach (DbParameterAccessor accessor in accessors) - { - if (!accessor.IsBoundToCheckOperation) - { - sb.Append(comma); - values.Append(comma); - sb.Append(accessor.DbParameter.SourceColumn); - values.Append(":").Append(accessor.DbParameter.ParameterName); - comma = ","; - } - else - { - retNames.Append(retComma); - retValues.Append(retComma); - retNames.Append(accessor.DbParameter.SourceColumn); - retValues.Append(":").Append(accessor.DbParameter.ParameterName); - retComma = ","; - } - } - sb.Append(") values ("); - sb.Append(values); - sb.Append(")"); - if (retValues.Length > 0) - { - sb.Append(" returning ").Append(retNames).Append(" into ").Append(retValues); - } - return sb.ToString(); - } - public override int GetExceptionCode(Exception dbException) - { - if (dbException is System.Data.OracleClient.OracleException) - return ((System.Data.OracleClient.OracleException)dbException).Code; - else if (dbException is System.Data.Common.DbException) - return ((System.Data.Common.DbException)dbException).ErrorCode; - else return 0; - } - public override String ParameterPrefix{ - get { return ":"; } - } - public override bool SupportsReturnOnInsert { get { return true; } } - public override String IdentitySelectStatement (string tableName){ throw new ApplicationException("Oracle supports return on insert"); } - - } -} diff --git a/source/dbfitOracle/OracleTest.cs b/source/dbfitOracle/OracleTest.cs deleted file mode 100644 index e2ab3386..00000000 --- a/source/dbfitOracle/OracleTest.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace dbfit{ - public class OracleTest:DatabaseTest { - public OracleTest(): base(new OracleEnvironment()){ - - } - } -} diff --git a/source/dbfitOracle/Properties/AssemblyInfo.cs b/source/dbfitOracle/Properties/AssemblyInfo.cs deleted file mode 100644 index db4e47e9..00000000 --- a/source/dbfitOracle/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("DbFit Oracle for fitSharp")] -[assembly: AssemblyDescription("DbFit. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2.")] -[assembly: AssemblyProduct("fitSharp")] -[assembly: ComVisible(false)] - -[assembly: AssemblyCopyright("Copyright © 2007 Gojko Adzic, 2022 Syterra Software Inc. All rights reserved.")] -[assembly: AssemblyVersion("2022.1.15.0")] diff --git a/source/dbfitOracle/dbfitOracle.csproj b/source/dbfitOracle/dbfitOracle.csproj deleted file mode 100644 index 5c634462..00000000 --- a/source/dbfitOracle/dbfitOracle.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - net48;net6.0;net6.0-windows;net7.0;net7.0-windows;net8.0;net8.0-windows - dbfit.Oracle - dbfit.Oracle - false - false - - - - - - - - - - \ No newline at end of file diff --git a/source/dbfitSqlServer/Properties/AssemblyInfo.cs b/source/dbfitSqlServer/Properties/AssemblyInfo.cs deleted file mode 100644 index 33bf7ee1..00000000 --- a/source/dbfitSqlServer/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("DbFit SqlServer for fitSharp")] -[assembly: AssemblyDescription("DbFit. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2.")] -[assembly: AssemblyProduct("fitSharp")] -[assembly: ComVisible(false)] - -[assembly: AssemblyCopyright("Copyright © 2007 Gojko Adzic, 2022 Syterra Software Inc. All rights reserved.")] -[assembly: AssemblyVersion("2022.1.15.0")] diff --git a/source/dbfitSqlServer/SqlServer2000Environment.cs b/source/dbfitSqlServer/SqlServer2000Environment.cs deleted file mode 100644 index 18ed02b9..00000000 --- a/source/dbfitSqlServer/SqlServer2000Environment.cs +++ /dev/null @@ -1,139 +0,0 @@ -/// Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -/// Released under GNU GPL 2.0 - -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Common; -using System.Data.SqlClient; -using System.Text.RegularExpressions; -using System.Xml; -using System.Text; -using dbfit.util; -using fit; - -namespace dbfit -{ - /// - /// Implementation of IDbEnviroment that works with SqlServer versions before 2005 - /// - class SqlServer2000Environment : SqlServerEnvironment - { - public override Dictionary GetAllProcedureParameters(String procName) - { - if (procName.Contains(".")) - { - String[] splitname = procName.Split('.'); - return ReadIntoParams( - @"select parameter_name,data_type,character_maximum_length, parameter_mode, - numeric_scale, numeric_precision - from information_schema.parameters - where SPECIFIC_NAME=@objname - and SPECIFIC_SCHEMA=@schemaname - order by ordinal_position", splitname[0], splitname[1] - ); - } - else - { - return ReadIntoParams( - @"select parameter_name,data_type,character_maximum_length, parameter_mode, - numeric_scale, numeric_precision - from information_schema.parameters - where SPECIFIC_NAME=@objname - and SPECIFIC_SCHEMA in ('dbo',user) - order by ordinal_position", procName, null - ); - } - } - public override Dictionary GetAllColumns(String tableOrViewName) - { - if (tableOrViewName.Contains(".")){ - String[] splitname = tableOrViewName.Split('.'); - return ReadIntoParams( - @"select column_name,data_type,character_maximum_length,'IN' as parameter_mode, - numeric_scale, numeric_precision - from information_schema.columns - where table_name=@objname - and table_schema =@schemaname - order by ordinal_position", splitname[0], splitname[1] - ); - } - else { - return ReadIntoParams( - @"select column_name,data_type,character_maximum_length,'IN' as parameter_mode, - numeric_scale, numeric_precision - from information_schema.columns - where table_name=@objname - and table_schema in ('dbo',user) - order by ordinal_position", tableOrViewName,null - ); - } - } - - private Dictionary ReadIntoParams(String query, String objname, String schemaname) - { - objname = NameNormaliser.NormaliseName(objname); - var cnx = CurrentConnection; - var dc = cnx.CreateCommand(); - dc.Transaction = (DbTransaction)CurrentTransaction; - dc.CommandText = query; - dc.CommandType = CommandType.Text; - AddInput(dc, "@objname", objname); - if (schemaname!=null) - AddInput(dc, "@schemaname", NameNormaliser.NormaliseName(schemaname)); - var reader = dc.ExecuteReader(); - Dictionary - allParams = new Dictionary(); - int position=0; - while (reader.Read()) - { - - String paramName = (reader.IsDBNull(0)) ? null : reader.GetString(0); - String dataType = reader.GetString(1); - int length = (reader.IsDBNull(2)) ? 0 : System.Convert.ToInt32(reader[2]); - String direction = (reader.IsDBNull(3)) ? "IN" : reader.GetString(3); - byte precision = 0; - byte scale = 0; - if (!reader.IsDBNull(4)) - scale=System.Convert.ToByte(reader[4]); - if (!reader.IsDBNull(5)) - precision = System.Convert.ToByte(reader[5]); - - SqlParameter dp = new SqlParameter(); - dp.Direction = GetParameterDirection(direction); - if (!String.IsNullOrEmpty(paramName)) { - dp.ParameterName = paramName; dp.SourceColumn=paramName; - } - else - { - dp.Direction = ParameterDirection.ReturnValue; - } - dp.SqlDbType= GetDBType(dataType); - if (precision > 0) dp.Precision = precision; - if (scale > 0) dp.Scale = scale; - - if (length > 0) - { - dp.Size = System.Convert.ToInt32(length); - } - else - { - if (!ParameterDirection.Input.Equals(dp.Direction) || typeof(String).Equals(GetDotNetType(dataType))) - dp.Size = 4000; - } - allParams[NameNormaliser.NormaliseName(paramName)] = - new DbParameterAccessor(dp, GetDotNetType(dataType), position++, dataType); - } - reader.Close(); - if (allParams.Count == 0) - throw new ApplicationException("Cannot read columns/parameters for object " + objname + " - check spelling or access privileges "); - return allParams; - } - private static ParameterDirection GetParameterDirection(String direction) - { - if ("IN".Equals(direction)) return ParameterDirection.Input; - if ("INOUT".Equals(direction)) return ParameterDirection.Output; - else return ParameterDirection.Output; - } - } -} diff --git a/source/dbfitSqlServer/SqlServer2000Test.cs b/source/dbfitSqlServer/SqlServer2000Test.cs deleted file mode 100644 index fa6d2ade..00000000 --- a/source/dbfitSqlServer/SqlServer2000Test.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace dbfit{ - public class SqlServer2000Test:DatabaseTest { - public SqlServer2000Test() - : base(new SqlServer2000Environment()) - { - - } - } -} diff --git a/source/dbfitSqlServer/SqlServerEnvironment.cs b/source/dbfitSqlServer/SqlServerEnvironment.cs deleted file mode 100644 index 84e6ed91..00000000 --- a/source/dbfitSqlServer/SqlServerEnvironment.cs +++ /dev/null @@ -1,296 +0,0 @@ -// Copyright © 2011 Syterra Software Inc. Includes work Copyright (C) Gojko Adzic 2006-2008 http://gojko.net -// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. -// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Common; -using System.Data.SqlClient; -using System.Text.RegularExpressions; -using dbfit.util; -using fitSharp.Machine.Engine; - -namespace dbfit -{ - /// - /// Implementation of IDbEnvironment that works with SqlServer 2005 and newer versions - /// - public class SqlServerEnvironment : AbstractDbEnvironment - { - private const int MAX_STRING_SIZE = 4000; - protected override String GetConnectionString(String dataSource, String username, String password, String databaseName) - { - return String.Format("data source={0};user id={1};password={2};database={3};", dataSource, username, password, databaseName); - } - - protected override String GetConnectionString(String dataSource, String username, String password) - { - return String.Format("Data Source={0}; User ID={1}; Password={2}", dataSource, username, password); - } - private static readonly DbProviderFactory dbp = DbProviderFactories.GetFactory("System.Data.SqlClient"); - private readonly Regex paramNames = new Regex("@([A-Za-z0-9_]*)"); - protected override Regex ParamNameRegex { get { return paramNames;}} - - public override DbProviderFactory DbProviderFactory - { - get { return dbp; } - } - public override Dictionary GetAllProcedureParameters(String procName) - { - string dbName = GetDbName(procName); - string retString = "select p.[name], TYPE_NAME(p.system_type_id) as [Type], p.max_length, p.is_output, p.is_cursor_ref, p.precision, p.scale from "; - retString += dbName + "sys.parameters p where p.object_id = OBJECT_ID(@objname) "; - retString += "UNION ALL select '','int',4,1,0,10,0 where EXISTS (SELECT * FROM "; - retString += dbName + "sys.objects WHERE object_id = OBJECT_ID(@objname) AND type in (N'P', N'PC'))"; - - return ReadIntoParams(procName, retString); - } - - private static string GetDbName(String objectName) - { - String[] objNameArr = objectName.Split(new[] { '.' }); - if (objNameArr.Length == 3) - { - //the table is in another database - return objNameArr[0] + "."; - } - return ""; - } - public override Dictionary GetAllColumns(String tableOrViewOrTypeName) - { - string dbName = GetDbName(tableOrViewOrTypeName); - return ReadIntoParams(tableOrViewOrTypeName, - @"SELECT c.[name], TYPE_NAME(c.system_type_id) as [Type], c.max_length, - 0 As is_output, 0 As is_cursor_ref, c.precision, c.scale - FROM " + dbName + @"sys.columns c - WHERE c.object_id = COALESCE(OBJECT_ID(@objname), (SELECT type_table_object_id FROM "+ dbName + @"sys.table_types WHERE user_type_id = TYPE_ID(@objname))) - ORDER BY column_id" ); - } - - private Dictionary ReadIntoParams(String objname, String query) - { - if (objname.Contains(".")) - { - // The object name is multi-part an will not be amended - } - else - { - objname = "[" + NameNormaliser.NormaliseName(objname) + "]"; - } - var cnx = (SqlConnection)CurrentConnection; - SqlCommand dc = cnx.CreateCommand(); - dc.Transaction = (SqlTransaction)CurrentTransaction; - dc.CommandText = query; - dc.CommandType = CommandType.Text; - dc.Parameters.Clear(); - AddInput(dc, "objname", objname); - DbDataReader reader = dc.ExecuteReader(); - var allParams = new Dictionary(); - int position=0; - while (reader.Read()) - { - String paramName = (reader.IsDBNull(0)) ? null : reader.GetString(0); - String dataType = reader.GetString(1); - int length = (reader.IsDBNull(2)) ? 0 : Convert.ToInt32(reader[2]); - int isOutput = (reader.IsDBNull(3)) ? 0 : Convert.ToInt32(reader[3]); - byte precision = Convert.ToByte(reader[5]); - byte scale = Convert.ToByte(reader[6]); - - var dp = new SqlParameter {Direction = GetParameterDirection(isOutput)}; - if (!String.IsNullOrEmpty(paramName)) { - dp.ParameterName = paramName; dp.SourceColumn=paramName; - } - else - { - dp.Direction = ParameterDirection.ReturnValue; - } - dp.SqlDbType= GetDBType(dataType); - String typeName = NormaliseTypeName(dataType); - if (precision > 0) dp.Precision = precision; - if (scale > 0) dp.Scale = scale; - if ("NTEXT".Equals(typeName)||("TEXT".Equals(typeName))) - dp.Size=MAX_STRING_SIZE; - else if ("NVARCHAR".Equals(typeName) || ("NCHAR".Equals(typeName))) - { - dp.Size = System.Convert.ToInt32(length) / 2; - } - else if (length > 0) - { - dp.Size = Convert.ToInt32(length); - } - else - { - if (!ParameterDirection.Input.Equals(dp.Direction) || - typeof(String).Equals(GetDotNetType(dataType))) - dp.Size = MAX_STRING_SIZE; - } - allParams[NameNormaliser.NormaliseName(paramName)] = - new DbParameterAccessor(dp, GetDotNetType(dataType), position++, dataType); - } - reader.Close(); - dc.Parameters.Clear(); - if (allParams.Count == 0) - throw new ApplicationException("Cannot read columns/parameters for object " + objname + " - check spelling or access privileges "); - return allParams; - } - private static readonly string[] SingleByteStringTypes = new string[] { "VARCHAR", "CHAR", "TEXT" }; - private static readonly string[] DoubleByteStringTypes = new string[] { "NVARCHAR", "NCHAR", "NTEXT" }; - private static readonly string[] XMLTypes = new string[] { "XML" }; - private static readonly string[] DecimalTypes = new[] { "DECIMAL", "NUMERIC", "MONEY", "SMALLMONEY" }; - private static readonly string[] DateTimeTypes = new[] { "SMALLDATETIME", "DATETIME" }; - private static readonly string[] DateTypes2008 = new[] { "DATETIME2" }; - private static readonly string[] DateTypes = new[] { "DATE" }; - private static readonly string[] TimeTypes = new[] { "TIME" }; - private static readonly string[] DateTimeOffsetTypes = new[] { "DATETIMEOFFSET" }; - private static readonly string[] RefCursorTypes = new[] { "REF" }; - private static readonly string[] Int8Types = new[] { "TINYINT" }; - private static readonly string[] Int16Types = new[] { "SMALLINT" }; - private static readonly string[] Int32Types=new[] {"INT"}; - private static readonly string[] Int64Types = new[] { "BIGINT"}; - private static readonly string[] TimestampTypes = new[] { "ROWVERSION", "TIMESTAMP" }; - - private static readonly string[] BooleanTypes = new[] { "BIT" }; - private static readonly string[] BinaryTypes = new[] { "BINARY", "VARBINARY", "IMAGE"};//, }; - private static readonly string[] GuidTypes = new[] { "UNIQUEIDENTIFIER" }; - private static readonly string[] VariantTypes = new[] { "SQL_VARIANT" }; - private static readonly string[] FloatTypes = new[] { "FLOAT" }; - private static readonly string[] RealTypes = new[] { "REAL" }; - private static readonly string[] Structured = new[] { "TABLE TYPE" }; - - private static string NormaliseTypeName(string dataType) - { - dataType = dataType.ToUpper().Trim(); - int idx = dataType.IndexOf(" "); - if (idx >= 0) dataType = dataType.Substring(0, idx); - idx = dataType.IndexOf("("); - if (idx >= 0) dataType = dataType.Substring(0, idx); - return dataType; - } - protected static SqlDbType GetDBType(String dataType) - { - //todo:strip everything from first blank - dataType = NormaliseTypeName(dataType); - - if (Array.IndexOf(SingleByteStringTypes, dataType) >= 0) return SqlDbType.VarChar; - if (Array.IndexOf(DoubleByteStringTypes, dataType) >= 0) return SqlDbType.NVarChar; - if (Array.IndexOf(XMLTypes, dataType) >= 0) return SqlDbType.Xml; - if (Array.IndexOf(DecimalTypes, dataType) >= 0) return SqlDbType.Decimal; - if (Array.IndexOf(DateTimeTypes, dataType) >= 0) return SqlDbType.DateTime; - if (Array.IndexOf(DateTypes2008, dataType) >= 0) return SqlDbType.DateTime2; - if (Array.IndexOf(DateTypes, dataType) >= 0) return SqlDbType.Date; - if (Array.IndexOf(TimeTypes, dataType) >= 0) return SqlDbType.Time; - if (Array.IndexOf(DateTimeOffsetTypes, dataType) >= 0) return SqlDbType.DateTimeOffset; - if (Array.IndexOf(Int8Types, dataType) >= 0) return SqlDbType.TinyInt; - if (Array.IndexOf(Int16Types, dataType) >= 0) return SqlDbType.SmallInt; - if (Array.IndexOf(Int32Types, dataType) >= 0) return SqlDbType.Int; - if (Array.IndexOf(Int64Types, dataType) >= 0) return SqlDbType.BigInt; - if (Array.IndexOf(BooleanTypes, dataType) >= 0) return SqlDbType.Bit; - if (Array.IndexOf(BinaryTypes,dataType)>=0) return SqlDbType.VarBinary; - if (Array.IndexOf(TimestampTypes, dataType) >= 0) return SqlDbType.Timestamp; - if (Array.IndexOf(GuidTypes, dataType) >= 0) return SqlDbType.UniqueIdentifier; - if (Array.IndexOf(VariantTypes, dataType) >= 0) return SqlDbType.Variant; - if (Array.IndexOf(FloatTypes, dataType) >= 0) return SqlDbType.Float; - if (Array.IndexOf(RealTypes, dataType) >= 0) return SqlDbType.Real; - if (Array.IndexOf(Structured, dataType) >= 0) return SqlDbType.Structured; - - throw new NotSupportedException("Type " + dataType + " is not supported"); - } - protected static Type GetDotNetType(String dataType) - { - dataType = NormaliseTypeName(dataType); - if (Array.IndexOf(SingleByteStringTypes, dataType) >= 0) return typeof(string); - if (Array.IndexOf(DoubleByteStringTypes, dataType) >= 0) return typeof(string); - if (Array.IndexOf(XMLTypes, dataType) >= 0) return typeof(string); - if (Array.IndexOf(DecimalTypes, dataType) >= 0) return typeof(decimal); - if (Array.IndexOf(Int8Types, dataType) >= 0) return typeof(byte); - if (Array.IndexOf(Int16Types, dataType) >= 0) return typeof(Int16); - if (Array.IndexOf(Int32Types, dataType) >= 0) return typeof(Int32); - if (Array.IndexOf(Int64Types, dataType) >= 0) return typeof(Int64); - if (Array.IndexOf(DateTimeTypes, dataType) >= 0) return typeof(DateTime); - if (Array.IndexOf(DateTypes, dataType) >= 0) return typeof(DateTime); - if (Array.IndexOf(DateTypes2008, dataType) >= 0) return typeof(DateTime); - if (Array.IndexOf(DateTimeOffsetTypes, dataType) >= 0) return typeof(DateTimeOffset); - if (Array.IndexOf(RefCursorTypes, dataType) >= 0) return typeof(DataTable); - if (Array.IndexOf(BooleanTypes, dataType) >= 0) return typeof(bool); - if (Array.IndexOf(BinaryTypes, dataType) >= 0) return typeof(byte[]); - if (Array.IndexOf(TimestampTypes, dataType) >= 0) return typeof(byte[]); - if (Array.IndexOf(GuidTypes, dataType) >= 0) return typeof(Guid); - if (Array.IndexOf(VariantTypes, dataType) >= 0) return typeof(string); - if (Array.IndexOf(FloatTypes, dataType) >= 0) return typeof(double); - if (Array.IndexOf(RealTypes, dataType) >= 0) return typeof(float); - if (Array.IndexOf(TimeTypes, dataType) >= 0) return typeof(TimeSpan); - if (Array.IndexOf(Structured, dataType) >= 0) return typeof(DataTable); - - throw new NotSupportedException(".net Type " + dataType + " is not supported"); - } - private static ParameterDirection GetParameterDirection(int isOutput) { - return isOutput==1 ? ParameterDirection.Output : ParameterDirection.Input; - } - - public override bool SupportsReturnOnInsert { get { return false; } } - public override String IdentitySelectStatement(string tableName) { - return tableName == null ? "select @@identity" : "select IDENT_CURRENT('" + tableName + "')"; - } - - public override int GetExceptionCode(Exception dbException) { - if (dbException is SqlException) - { - Console.WriteLine("SQL Exception " + ((SqlException)dbException).Number); - return ((SqlException)dbException).Number; - } - return base.GetExceptionCode(dbException); - } - - public override string ParameterPrefix - { - get { return "@";} - } - - protected override string BuildColumnName(string sourceColumnName) - { - return "[" + sourceColumnName + "]"; - } - - protected override void AddInput(IDbCommand dbCommand, String name, Object value) - { - SqlParameter dbParameter; - var cmd = (SqlCommand)dbCommand; - - var parameter = value as TableTypeParameter; - if (parameter != null) - { - dbParameter = cmd.Parameters.AddWithValue(name, parameter.Datatable ); - dbParameter.Direction = ParameterDirection.Input; - dbParameter.SqlDbType = SqlDbType.Structured ; - dbParameter.TypeName = parameter.Tabletype; - } - else - { - dbParameter = cmd.Parameters.AddWithValue(name, (value ?? DBNull.Value)); - dbParameter.Direction = ParameterDirection.Input; - } - } - public override void BindFixtureSymbols(Symbols symbols, IDbCommand dc) - { - foreach (String paramName in ExtractParamNames(dc.CommandText)) - { - AddInput(dc, paramName, symbols.GetValueOrDefault(paramName, null)); - } - } - - public override IDbCommand CreateCommand(string statement, CommandType commandType) - { - if (CurrentConnection == null) throw new ApplicationException("Not connected to database"); - - var cnx = CurrentConnection; - var dc = cnx.CreateCommand(); - dc.CommandText = statement.Replace("\r", " ").Replace("\n", " "); - dc.CommandType = commandType; - dc.Transaction = CurrentTransaction; - dc.CommandTimeout = Options.CommandTimeOut; - return dc; - } - } -} diff --git a/source/dbfitSqlServer/SqlServerTest.cs b/source/dbfitSqlServer/SqlServerTest.cs deleted file mode 100644 index 72646404..00000000 --- a/source/dbfitSqlServer/SqlServerTest.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace dbfit{ - public class SqlServerTest:DatabaseTest { - public SqlServerTest(): base(new SqlServerEnvironment()){ - - } - } -} diff --git a/source/dbfitSqlServer/dbfitSqlServer.csproj b/source/dbfitSqlServer/dbfitSqlServer.csproj deleted file mode 100644 index 59cb7b24..00000000 --- a/source/dbfitSqlServer/dbfitSqlServer.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - net48;net6.0;net6.0-windows;net7.0;net7.0-windows;net8.0;net8.0-windows - dbfit.SqlServer - dbfit.SqlServer - false - false - - - - - - - - - - - \ No newline at end of file diff --git a/source/dbfitSybase/Properties/AssemblyInfo.cs b/source/dbfitSybase/Properties/AssemblyInfo.cs deleted file mode 100644 index 67283d14..00000000 --- a/source/dbfitSybase/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("DbFit Sybase for fitSharp")] -[assembly: AssemblyDescription("DbFit. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2.")] -[assembly: AssemblyProduct("fitSharp")] -[assembly: ComVisible(false)] - -[assembly: AssemblyCopyright("Copyright © 2022 Syterra Software Inc. All rights reserved.")] -[assembly: AssemblyVersion("2022.1.15.0")] diff --git a/source/dbfitSybase/SybaseEnvironment.cs b/source/dbfitSybase/SybaseEnvironment.cs deleted file mode 100644 index 36aca1fc..00000000 --- a/source/dbfitSybase/SybaseEnvironment.cs +++ /dev/null @@ -1,264 +0,0 @@ -// -// Ori Helman -// 12 Aug 2010 -// Contains an implementation for the Sybase database. It was tested with Sybase 12.5. -// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. -// - -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Common; -using System.Text.RegularExpressions; -using dbfit.util; -using Sybase.Data.AseClient; - -namespace dbfit -{ - public class SybaseEnvironment : AbstractDbEnvironment - { - private const int MAX_STRING_SIZE = 32767; - public override string ParameterPrefix - { - get { return "@"; } - } - - protected override string GetConnectionString(string dataSource, string username, string password) - { - return String.Format("Data Source={0}; User ID={1}; pwd={2}", dataSource, username, password); - } - - protected override string GetConnectionString(string dataSource, string username, string password, string database) - { - return String.Format("Data Source={0}; User ID={1}; pwd={2}; DatabaseName={3}", dataSource, username, password, database); - } - - private Regex paramNames = new Regex("@([A-Za-z0-9_]*)"); - private static DbProviderFactory dbp = new AseClientFactory(); - - protected override Regex ParamNameRegex - { - - get { return paramNames; } - } - - protected override void AddInput(IDbCommand dbCommand, String name, Object value) - { - var cmd = dbCommand; - var dbParameter = cmd.CreateParameter(); - dbParameter.Direction = ParameterDirection.Input; - if (!name.StartsWith(ParameterPrefix)) - dbParameter.ParameterName = ParameterPrefix + name; - else - dbParameter.ParameterName = name; - dbParameter.Value = (value == null ? DBNull.Value : value); - dbCommand.Parameters.Add(dbParameter); - } - - - public override DbProviderFactory DbProviderFactory - { - get { return dbp; } - } - - public override string IdentitySelectStatement(string tableName) { - return tableName == null ? "select @@identity" : "select IDENT_CURRENT('" + tableName + "')"; - } - - public override Dictionary GetAllProcedureParameters(string procName) - { - return ReadIntoParams(procName, -@" select c.name column_name - , t.name type_name - , c.length - , c.status2 - , c.prec - , c.scale - from sysobjects o - join syscolumns c on o.id = c.id - join systypes t on t.usertype = c.usertype - where o.type = 'P' - and o.name=@objname - "); - } - - public override Dictionary GetAllColumns(string tableOrViewName) - { - return ReadIntoParams(tableOrViewName, -@" select c.name column_name - , t.name type_name - , c.length - , c.status2 - , c.prec - , c.scale - from sysobjects o - join syscolumns c on o.id = c.id - join systypes t on t.usertype = c.usertype - where o.type in ('U','V') - and o.name=@objname - "); - } - - public override bool SupportsReturnOnInsert - { - get { return false;} - } - - - public override int GetExceptionCode(Exception dbException) - { - - if (dbException is Sybase.Data.AseClient.AseException) - { - AseException ae = dbException as AseException; - if (ae.Errors != null) - { - AseError aseError = ae.Errors[0]; - Console.WriteLine("Sybase Exception code" + aseError.MessageNumber); - return aseError.MessageNumber; - } - } - - return base.GetExceptionCode(dbException); - } - - private Dictionary ReadIntoParams(String objname, String query) - { - if (objname.Contains(".")) - { - String[] schemaAndName = objname.Split(new char[] { '.' }, 2); - objname = schemaAndName[0] + ".." + schemaAndName[1] ; - } - else - { - objname = NameNormaliser.NormaliseName(objname) ; - } - var cnx = CurrentConnection; - var dc = cnx.CreateCommand(); - dc.Transaction = (DbTransaction)CurrentTransaction; - dc.CommandText = query; - dc.CommandType = CommandType.Text; - AddInput(dc, "@objname", objname); - var reader = dc.ExecuteReader(); - Dictionary allParams = new Dictionary(); - int position = 0; - while (reader.Read()) - { - - String paramName = (reader.IsDBNull(0)) ? null : reader.GetString(0); - String dataType = reader.GetString(1); - int length = (reader.IsDBNull(2)) ? 0 : System.Convert.ToInt32(reader[2]); - int isOutput = (reader.IsDBNull(3)) ? 0 : System.Convert.ToInt32(reader[3]); - byte precision = (reader.IsDBNull(4)) ? Convert.ToByte(0) : System.Convert.ToByte(reader[4]); - byte scale = (reader.IsDBNull(5)) ? Convert.ToByte(0) : System.Convert.ToByte(reader[5]); - - AseParameter dp = new AseParameter(); - dp.Direction = GetParameterDirection(isOutput); - if (!String.IsNullOrEmpty(paramName)) - { - if (!paramName.StartsWith(ParameterPrefix)) - dp.ParameterName = ParameterPrefix + paramName; - else - dp.ParameterName = paramName; - dp.SourceColumn = paramName; - } - else - { - dp.Direction = ParameterDirection.ReturnValue; - } - dp.AseDbType = GetDBType(dataType); - String typeName = NormaliseTypeName(dataType); - if (precision > 0) dp.Precision = precision; - if (scale > 0) dp.Scale = scale; - if ("NTEXT".Equals(typeName) || ("TEXT".Equals(typeName))) - dp.Size = MAX_STRING_SIZE; - else if (length > 0) - { - dp.Size = System.Convert.ToInt32(length); - } - else - { - if (!ParameterDirection.Input.Equals(dp.Direction) || - typeof(String).Equals(GetDotNetType(dataType))) - dp.Size = MAX_STRING_SIZE; - } - allParams[NameNormaliser.NormaliseName(paramName)] = new DbParameterAccessor(dp, GetDotNetType(dataType), position++, dataType); - } - reader.Close(); - return allParams; - } - - private static ParameterDirection GetParameterDirection(int isOutput) - { - if (isOutput == 2) return ParameterDirection.Output; - else return ParameterDirection.Input; - } - - private static string[] StringTypes = new string[] { "VARCHAR", "NVARCHAR", "CHAR", "NCHAR", "TEXT", "NTEXT", "XML" }; - private static string[] DecimalTypes = new string[] { "DECIMAL", "NUMERIC", "MONEY", "SMALLMONEY" }; - private static string[] DateTypes = new string[] { "SMALLDATETIME", "DATETIME", "TIMESTAMP" }; - private static string[] RefCursorTypes = new string[] { "REF" }; - private static string[] Int32Types = new string[] { "INT" }; - private static string[] Int16Types = new string[] { "TINYINT", "SMALLINT" }; - private static string[] Int64Types = new string[] { "BIGINT" }; - - private static string[] BooleanTypes = new string[] { "BIT" }; - private static string[] BinaryTypes = new string[] { "BINARY", "VARBINARY", "IMAGE" }; - private static string[] GuidTypes = new string[] { "UNIQUEIDENTIFIER" }; - private static string[] VariantTypes = new string[] { "SQL_VARIANT" }; - private static string[] FloatTypes = new String[] { "REAL", "FLOAT" }; - private static string NormaliseTypeName(string dataType) - { - dataType = dataType.ToUpper().Trim(); - int idx = dataType.IndexOf(" "); - if (idx >= 0) dataType = dataType.Substring(0, idx); - idx = dataType.IndexOf("("); - if (idx >= 0) dataType = dataType.Substring(0, idx); - return dataType; - - } - protected static AseDbType GetDBType(String dataType) - { - //todo:strip everything from first blank - dataType = NormaliseTypeName(dataType); - - if (Array.IndexOf(StringTypes, dataType) >= 0) return AseDbType.VarChar; - if (Array.IndexOf(DecimalTypes, dataType) >= 0) return AseDbType.Decimal; - if (Array.IndexOf(DateTypes, dataType) >= 0) return AseDbType.DateTime; - if (Array.IndexOf(Int32Types, dataType) >= 0) return AseDbType.Integer; - if (Array.IndexOf(Int16Types, dataType) >= 0) return AseDbType.Integer; - if (Array.IndexOf(Int64Types, dataType) >= 0) return AseDbType.Integer; - if (Array.IndexOf(BooleanTypes, dataType) >= 0) return AseDbType.Bit; - if (Array.IndexOf(BinaryTypes, dataType) >= 0) return AseDbType.VarBinary; - //if (Array.IndexOf(RefCursorTypes, dataType) >= 0) return OracleType.Cursor; - if (Array.IndexOf(GuidTypes, dataType) >= 0) return AseDbType.VarChar; - if (Array.IndexOf(VariantTypes, dataType) >= 0) return AseDbType.VarChar; - if (Array.IndexOf(FloatTypes, dataType) >= 0) return AseDbType.Decimal; - - throw new NotSupportedException("Type " + dataType + " is not supported"); - } - protected static Type GetDotNetType(String dataType) - { - dataType = NormaliseTypeName(dataType); - if (Array.IndexOf(StringTypes, dataType) >= 0) return typeof(string); - if (Array.IndexOf(DecimalTypes, dataType) >= 0) return typeof(decimal); - if (Array.IndexOf(Int32Types, dataType) >= 0) return typeof(Int32); - if (Array.IndexOf(Int16Types, dataType) >= 0) return typeof(Int16); - if (Array.IndexOf(Int64Types, dataType) >= 0) return typeof(Int64); - if (Array.IndexOf(DateTypes, dataType) >= 0) return typeof(DateTime); - if (Array.IndexOf(RefCursorTypes, dataType) >= 0) return typeof(DataTable); - if (Array.IndexOf(BooleanTypes, dataType) >= 0) return typeof(bool); - if (Array.IndexOf(BinaryTypes, dataType) >= 0) return typeof(byte[]); - // if (Array.IndexOf(GuidTypes, dataType) >= 0) return typeof(System.Guid); - if (Array.IndexOf(GuidTypes, dataType) >= 0) return typeof(string); - if (Array.IndexOf(VariantTypes, dataType) >= 0) return typeof(string); - if (Array.IndexOf(FloatTypes, dataType) >= 0) return typeof(double); - - throw new NotSupportedException("Type " + dataType + " is not supported"); - } - - - - - } -} diff --git a/source/dbfitSybase/SybaseTest.cs b/source/dbfitSybase/SybaseTest.cs deleted file mode 100644 index 4d829fcb..00000000 --- a/source/dbfitSybase/SybaseTest.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace dbfit -{ - public class SybaseTest: DatabaseTest - { - public SybaseTest() - : base(new SybaseEnvironment()) - { - - } - } -} \ No newline at end of file diff --git a/source/dbfitSybase/dbfitSybase.csproj b/source/dbfitSybase/dbfitSybase.csproj deleted file mode 100644 index 51ef2435..00000000 --- a/source/dbfitSybase/dbfitSybase.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - net48;net6.0;net6.0-windows;net7.0;net7.0-windows;net8.0;net8.0-windows - dbfit.Sybase - dbfit.Sybase - false - false - - - - - - - - - - - ..\..\binary\tools\sybase\Sybase.AdoNet2.AseClient.dll - - - - \ No newline at end of file diff --git a/source/dbfitTest/DbConnectionPropertiesTest.cs b/source/dbfitTest/DbConnectionPropertiesTest.cs deleted file mode 100644 index 7a00fae6..00000000 --- a/source/dbfitTest/DbConnectionPropertiesTest.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using NUnit.Framework; - - -namespace dbfit.util -{ - [TestFixture] - - public class DbConnectionPropertiesTest - { - [Test] - public void TestWithConnectionString() - { - DbConnectionProperties props=DbConnectionProperties.CreateFromString( - @"connection-string=test1234"); - Assert.AreEqual("test1234", props.FullConnectionString); - Assert.IsNull(props.Username); - Assert.IsNull(props.Password); - Assert.IsNull(props.Service); - Assert.IsNull(props.DbName); - } - [Test] - public void TestWithConnectionStringWithEquals() - { - DbConnectionProperties props = DbConnectionProperties.CreateFromString( - @"connection-string=test1234&Username=US&Password=PW"); - Assert.AreEqual("test1234&Username=US&Password=PW", props.FullConnectionString); - Assert.IsNull(props.Username); - Assert.IsNull(props.Password); - Assert.IsNull(props.Service); - Assert.IsNull(props.DbName); - } - [Test] - public void TestWithSplitProperties() - { - DbConnectionProperties props = DbConnectionProperties.CreateFromString( - @"service=testsvc - username=testuser - password=testpwd - database=testdb"); - Assert.IsNull(props.FullConnectionString); - Assert.AreEqual("testuser",props.Username); - Assert.AreEqual("testpwd",props.Password); - Assert.AreEqual("testsvc",props.Service); - Assert.AreEqual("testdb",props.DbName); - } - [Test] - public void TestCommentsAndEmptyLines() - { - DbConnectionProperties props = DbConnectionProperties.CreateFromString( - @"service=testsvc - - username=testuser - password=testpwd - #this is a comment - database=testdb - "); - Assert.IsNull(props.FullConnectionString); - Assert.AreEqual("testuser", props.Username); - Assert.AreEqual("testpwd", props.Password); - Assert.AreEqual("testsvc", props.Service); - Assert.AreEqual("testdb", props.DbName); - } - - } -} diff --git a/source/dbfitTest/ExecuteProcedureTest.cs b/source/dbfitTest/ExecuteProcedureTest.cs deleted file mode 100644 index e2d1aa3a..00000000 --- a/source/dbfitTest/ExecuteProcedureTest.cs +++ /dev/null @@ -1,197 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Common; -using System.Data.SqlClient; -using dbfit; -using dbfit.fixture; -using fit; -using fit.Service; -using Moq; -using NUnit.Framework; -using TestStatus=fitSharp.Fit.Model.TestStatus; - -namespace dbfitTest { - [TestFixture] public class ExecuteProcedureTest { - private ExecuteProcedure fixture; - private Mock db; - - [SetUp] public void SetUp() { - db = new Mock(); - fixture = new ExecuteProcedure(db.Object, "myproc") {Processor = new Service()}; - } - - [Test] - public void SortAccessorsInRightOrder() - { - //Prepare - var accessorsToOrder = new DbParameterAccessor[4]; - accessorsToOrder[0]=new DbParameterAccessor(new SqlParameter(), typeof(string), 1, "String"); - accessorsToOrder[3]=new DbParameterAccessor(new SqlParameter(), typeof(string), 3, "String"); - accessorsToOrder[2]=new DbParameterAccessor(new SqlParameter(), typeof(string), 5, "String"); - accessorsToOrder[1]=new DbParameterAccessor(new SqlParameter(), typeof(string), 7, "String"); - - //Execute - DbParameterAccessor[] resultingAccessors = ExecuteProcedure.SortAccessors(accessorsToOrder); - - //Verify - Assert.AreEqual(1, resultingAccessors[0].Position); - Assert.AreEqual(3, resultingAccessors[1].Position); - Assert.AreEqual(5, resultingAccessors[2].Position); - Assert.AreEqual(7, resultingAccessors[3].Position); - } - [Test] public void ExecutesProcedureWithNoParameters() { - var command = new TestCommand(); - RunTest(command, null, string.Empty); - Assert.AreEqual(1, command.ExecuteNonQueryCalls); - } - - [Test] public void ExecutesProcedureWithInputParameter() { - var command = new TestCommand { - NonQueryAction = (c => Assert.AreEqual("invalue", c.Parameters[0].Value)) - }; - - RunTest(command, MakeParameters("inparm", ParameterDirection.Input), - ""); - - Assert.AreEqual(1, command.ExecuteNonQueryCalls); - } - - [Test] public void ExecutesProcedureWithOutputParameter() { - var command = new TestCommand { - NonQueryAction = (c => c.Parameters[0].Value = "outvalue") - }; - - RunTest(command, MakeParameters("outparm", ParameterDirection.Output), - ""); - - Assert.AreEqual(1, command.ExecuteNonQueryCalls); - Assert.AreEqual(1, fixture.TestStatus.Counts.GetCount(TestStatus.Right)); - } - - [Test] public void ExecutesProcedureWithInOutParameter() { - var command = new TestCommand { - NonQueryAction = (c => { - Assert.AreEqual("invalue", c.Parameters[0].Value); - c.Parameters[0].Value = "outvalue"; - }) - }; - - RunTest(command, MakeParameters("ioparm", ParameterDirection.InputOutput), - ""); - - Assert.AreEqual(1, command.ExecuteNonQueryCalls); - Assert.AreEqual(1, fixture.TestStatus.Counts.GetCount(TestStatus.Right)); - } - - [Test] public void MarksWrongIfNoExpectedException() { - fixture = new ExecuteProcedure(db.Object, "myproc", true) {Processor = new Service()}; - var command = new TestCommand(); - - RunTest(command, MakeParameters("inparm", ParameterDirection.Input), - ""); - - Assert.AreEqual(1, command.ExecuteNonQueryCalls); - Assert.AreEqual(1, fixture.TestStatus.Counts.GetCount(TestStatus.Wrong)); - } - - [Test] public void MarksRightIfExpectedException() { - fixture = new ExecuteProcedure(db.Object, "myproc", true) {Processor = new Service()}; - var command = new TestCommand { - NonQueryAction = (c => { throw new ApplicationException();}) - }; - - RunTest(command, MakeParameters("inparm", ParameterDirection.Input), - ""); - - Assert.AreEqual(1, command.ExecuteNonQueryCalls); - Assert.AreEqual(1, fixture.TestStatus.Counts.GetCount(TestStatus.Right)); - } - - private static Dictionary MakeParameters(string parameterName, ParameterDirection direction) { - var parameter = new SqlParameter(parameterName, SqlDbType.VarChar, 10) {Direction = direction}; - return new Dictionary - {{parameterName, new DbParameterAccessor(parameter, typeof (string), 0, "varchar")}}; - } - - private void RunTest(DbCommand command, Dictionary parameters, string html) { - db.Setup(d => d.CreateCommand("myproc", CommandType.StoredProcedure)) - .Returns(command); - db.Setup(d => d.GetAllProcedureParameters("myproc")) - .Returns(parameters); - Parse table = Parse.ParseFrom(string.Format("
inparm
invalue
outparm?
outvalue
ioparmioparm?
invalueoutvalue
inparm
invalue
inparm
invalue
{0}
executeproceduremyproc
", html)); - fixture.DoTable(table); - } - } - - public class TestCommand: DbCommand { - public readonly SqlCommand Command = new SqlCommand(); - public int ExecuteNonQueryCalls; - public Action NonQueryAction; - - public override void Prepare() { - throw new NotImplementedException(); - } - - public override string CommandText { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - public override int CommandTimeout { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - public override CommandType CommandType { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - public override UpdateRowSource UpdatedRowSource { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - protected override DbConnection DbConnection { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - protected override DbParameterCollection DbParameterCollection { - get { return Command.Parameters; } - } - - protected override DbTransaction DbTransaction { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - public override bool DesignTimeVisible { - get { throw new NotImplementedException(); } - set { throw new NotImplementedException(); } - } - - public override void Cancel() { - throw new NotImplementedException(); - } - - protected override DbParameter CreateDbParameter() { - throw new NotImplementedException(); - } - - protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior) { - throw new NotImplementedException(); - } - - public override int ExecuteNonQuery() { - ExecuteNonQueryCalls++; - if (NonQueryAction != null) NonQueryAction(this); - return 0; - } - - public override object ExecuteScalar() { - throw new NotImplementedException(); - } - } -} diff --git a/source/dbfitTest/NameNormaliserTest.cs b/source/dbfitTest/NameNormaliserTest.cs deleted file mode 100644 index bfd4e80b..00000000 --- a/source/dbfitTest/NameNormaliserTest.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -using dbfit.util; -using NUnit.Framework; - -namespace dbfit { - [TestFixture] - public class NameNormaliserTest { - - [Test] - public void CheckNormaliseName() { - Assert.AreEqual("dbtest", NameNormaliser.NormaliseName("dbtest?")); - Assert.AreEqual("dbtest", NameNormaliser.NormaliseName("db test")); - Assert.AreEqual("dbtest", NameNormaliser.NormaliseName("db test?")); - Assert.AreEqual("db.test", NameNormaliser.NormaliseName("db.test")); - Assert.AreEqual("db_test", NameNormaliser.NormaliseName("db_test")); - Assert.AreEqual("dbtest", NameNormaliser.NormaliseName("DbTeSt")); - } - } -} diff --git a/source/dbfitTest/OracleEnvironmentTest.cs b/source/dbfitTest/OracleEnvironmentTest.cs deleted file mode 100644 index 4ec56c9f..00000000 --- a/source/dbfitTest/OracleEnvironmentTest.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using NUnit.Framework; - - -namespace dbfit { - [TestFixture] - public class OracleEnvironmentTest { - private OracleEnvironment oe=new OracleEnvironment(); - [Test] - public void CheckEmptyParams() { - Assert.AreEqual(0,oe.ExtractParamNames("select * from dual").Length); - } - [Test] - public void CheckSingleParam() { - Assert.AreEqual(new string[]{"mydate"}, oe.ExtractParamNames("select * from dual where sysdate<:mydate")); - } - [Test] - public void CheckMultipleParams() { - string[] paramnames=oe.ExtractParamNames("select :myname as zeka from dual where sysdate<:mydate"); - Assert.AreEqual(2,paramnames.Length); - Assert.Contains("mydate", paramnames); - Assert.Contains("myname", paramnames); - } - [Test] - public void CheckMultipleParamsRecurring() { - string[] paramnames = oe.ExtractParamNames("select :myname,length(:myname) as l, :myname || :mydate as zeka2 from dual where sysdate<:mydate"); - Assert.AreEqual(2, paramnames.Length); - Assert.Contains("mydate", paramnames); - Assert.Contains("myname", paramnames); - } - [Test] - public void CheckUnderscore() { - Assert.AreEqual(new string[] { "my_date" }, oe.ExtractParamNames("select * from dual where sysdate<:my_date")); - } - } -} diff --git a/source/dbfitTest/Properties/AssemblyInfo.cs b/source/dbfitTest/Properties/AssemblyInfo.cs deleted file mode 100644 index 54b0319a..00000000 --- a/source/dbfitTest/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("DbFit tests for fitSharp")] -[assembly: AssemblyDescription("DbFit. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2.")] -[assembly: AssemblyProduct("fitSharp")] -[assembly: ComVisible(false)] - -[assembly: AssemblyCopyright("Copyright © 2007 Gojko Adzic, 2022 Syterra Software Inc. All rights reserved.")] -[assembly: AssemblyVersion("2022.1.15.0")] diff --git a/source/dbfitTest/QueryTest.cs b/source/dbfitTest/QueryTest.cs deleted file mode 100644 index 403e58e2..00000000 --- a/source/dbfitTest/QueryTest.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright © 2016 Syterra Software Inc. All rights reserved. -// The use and distribution terms for this software are covered by the Common Public License 1.0 (http://opensource.org/licenses/cpl.php) -// which can be found in the file license.txt at the root of this distribution. By using this software in any fashion, you are agreeing -// to be bound by the terms of this license. You must not remove this notice, or any other, from this software. - -using System.Data; -using dbfit.fixture; -using fit; -using fit.Service; -using fitSharp.Machine.Model; -using NUnit.Framework; -using TestStatus=fitSharp.Fit.Model.TestStatus; - -namespace dbfitTest { - [TestFixture] - public class QueryTest { - [Test] - public void AccessesColumnWithQuotedUnderscore() { - AssertQuery("some_column", "\"some_column\""); - } - - [Test] - public void AccessesColumnWithQuestionMark() { - AssertQuery("somecolumn", "somecolumn?"); - } - - [Test] - public void AccessesColumnWithWithQuotedUnderscoreAndQuestionMark() { - AssertQuery("some_column", "\"some_column\"?"); - } - - private static void AssertQuery(string columnName, string headerCellName) { - var dataTable = new DataTable(); - dataTable.Columns.Add("somekey", typeof (string)); - dataTable.Columns.Add(columnName, typeof (string)); - var newRow = dataTable.NewRow(); - newRow["somekey"] = "key"; - newRow[columnName] = "value"; - dataTable.Rows.Add(newRow); - var fixture = new Query(dataTable, false) {Processor = new Service()}; - - var testTable = new CellTree( - new CellTree("query"), - new CellTree("somekey", headerCellName), - new CellTree("key", "value") - ); - Parse parseTable = Parse.CopyFrom(testTable); - fixture.DoTable(parseTable); - Assert.AreEqual(TestStatus.Right, parseTable.At(0, 2, 0).GetAttribute(CellAttribute.Status)); - Assert.AreEqual(TestStatus.Right, parseTable.At(0, 2, 1).GetAttribute(CellAttribute.Status)); - } - } -} diff --git a/source/dbfitTest/SqlServerEnvironmentTest.cs b/source/dbfitTest/SqlServerEnvironmentTest.cs deleted file mode 100644 index eb91e42c..00000000 --- a/source/dbfitTest/SqlServerEnvironmentTest.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright © 2012 Syterra Software Inc. -// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. -// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -using System.Data.Common; -using dbfit; -using NUnit.Framework; - -namespace dbfitTest { - [TestFixture] public class SqlServerEnvironmentTest { - [Test] public void BuildsInsertCommand() { - var environment = new SqlServerEnvironment(); - var parameterA = MakeParameter(environment, "aColumn", "aParameter"); - var parameterB = MakeParameter(environment, "bColumn", "bParameter"); - var command = environment.BuildInsertCommand( - "aTable", - new[] { - new DbParameterAccessor(parameterA, typeof(string), 0, "varchar"), - new DbParameterAccessor(parameterB, typeof(int), 1, "integer") - }); - Assert.AreEqual("insert into aTable([aColumn],[bColumn]) values (@aParameter,@bParameter)", command); - } - - static DbParameter MakeParameter(SqlServerEnvironment environment, string sourceColumn, string parameterName) { - var parameterA = environment.DbProviderFactory.CreateParameter(); - parameterA.SourceColumn = sourceColumn; - parameterA.ParameterName = parameterName; - return parameterA; - } - - [Test] public void BuildUpdateCommand() { - var environment = new SqlServerEnvironment(); - var parameterA = MakeParameter(environment, "aColumn", "aParameter"); - var parameterB = MakeParameter(environment, "bColumn", "bParameter"); - var parameterC = MakeParameter(environment, "cColumn", "cParameter"); - var parameterD = MakeParameter(environment, "dColumn", "dParameter"); - var command = environment.BuildUpdateCommand( - "aTable", - new [] { - new DbParameterAccessor(parameterA, typeof(string), 0, "varchar"), - new DbParameterAccessor(parameterB, typeof(int), 1, "integer") - }, - new[] { - new DbParameterAccessor(parameterC, typeof(string), 2, "varchar"), - new DbParameterAccessor(parameterD, typeof(int), 3, "integer") - }); - Assert.AreEqual("update aTable set [aColumn]=@aParameter, [bColumn]=@bParameter where [cColumn]=@cParameter and [dColumn]=@dParameter", command); - } - } -} diff --git a/source/dbfitTest/acceptancescripts-MySql.sql b/source/dbfitTest/acceptancescripts-MySql.sql deleted file mode 100644 index 455e2e1f..00000000 --- a/source/dbfitTest/acceptancescripts-MySql.sql +++ /dev/null @@ -1,31 +0,0 @@ -create database dbfit; - -grant all privileges on dbfit.* to dftest@localhost identified by 'dftest'; - -grant all privileges on dbfit.* to dftest@127.0.0.1 identified by 'dftest'; - -grant all privileges on dbfit.* to dbfit_user@localhost identified by 'password'; - -grant all privileges on dbfit.* to dbfit_user@127.0.0.1 identified by 'password'; - -grant select on mysql.* to dbfit_user@localhost; - -flush privileges; - -use dbfit; - -create table users(name varchar(50) unique, username varchar(50), userid int auto_increment primary key); - -CREATE PROCEDURE ConcatenateStrings (IN firststring varchar(100), IN secondstring varchar(100), OUT concatenated varchar(200)) set concatenated = concat(firststring , concat( ' ' , secondstring )); - -create procedure CalcLength(IN name varchar(100), OUT strlength int) set strlength =length(name); - -CREATE FUNCTION ConcatenateF (firststring VARCHAR(100), secondstring varchar(100)) RETURNS VARCHAR(200) RETURN CONCAT(firststring,' ',secondstring); - -create procedure makeuser() insert into users (name,username) values ('user1','fromproc'); - -create procedure createuser(IN newname varchar(100), IN newusername varchar(100)) insert into users (name,username) values (newname, newusername); - -create procedure Multiply(IN factor int, INOUT val int) set val =val*factor; - -Create table Test_DBFit(name varchar(50), luckyNumber int) engine=InnoDB; diff --git a/source/dbfitTest/acceptancescripts-SqlServer.sql b/source/dbfitTest/acceptancescripts-SqlServer.sql deleted file mode 100644 index cdc99641..00000000 --- a/source/dbfitTest/acceptancescripts-SqlServer.sql +++ /dev/null @@ -1,233 +0,0 @@ -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Multiply]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT')) -BEGIN -execute dbo.sp_executesql @statement = N' create function [dbo].[Multiply](@n1 int, @n2 int) returns int as begin declare @num3 int; set @num3 = @n1*@n2; return @num3; end; ' -END - -GO -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[CalcLength_P]') AND type in (N'P', N'PC')) -BEGIN -EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[CalcLength_P] -@name VARCHAR(255) -, @strlength INT OUTPUT -AS -BEGIN - SET @strlength = DataLength(@name); -END; -' -END -GO -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ReturnUserTable_F]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT')) -BEGIN -execute dbo.sp_executesql @statement = N'-- ============================================= --- Author: --- Create date: --- Description: --- ============================================= -CREATE FUNCTION [dbo].[ReturnUserTable_F] -( - @howmuch int -) -RETURNS -@userTable TABLE -( - -- Add the column definitions for the TABLE variable here - [user] varchar(50), - [username] varchar(255) -) -AS -BEGIN - -- Fill the table variable with the rows for your result set - DECLARE @i INT - SET @i = 0 - WHILE (@i < @howmuch) - BEGIN - SET @i = @i + 1 - INSERT @userTable([user], [username]) - VALUES(''User '' + CAST(@i AS VARCHAR(10)), ''Username '' + CAST(@i AS VARCHAR(10))) - END - - RETURN -END -' -END - -GO -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ConcatenateStrings_P]') AND type in (N'P', N'PC')) -BEGIN -EXEC dbo.sp_executesql @statement = N' -CREATE PROCEDURE [dbo].[ConcatenateStrings_P] -@firstString varchar(255) -,@secondString varchar(255) -,@concatenated varchar(600) output -AS -BEGIN - SET @concatenated = @firstString + '' '' + @secondString -END -' -END -GO -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ConcatenateStrings_F]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT')) -BEGIN -execute dbo.sp_executesql @statement = N' -CREATE FUNCTION [dbo].[ConcatenateStrings_F] -( -@firstString varchar(255) -,@secondString varchar(255) -) -RETURNS VARCHAR(600) -AS -BEGIN - DECLARE @concatenated VARCHAR(600) - SET @concatenated = @firstString + '' '' + @secondString - RETURN @concatenated -END -' -END - -GO -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Users]') AND type in (N'U')) -BEGIN -CREATE TABLE [dbo].[Users]( - [name] [varchar](50) NULL, - [username] [varchar](50) NULL, - [userid] [int] IDENTITY(1,1) NOT NULL -) ON [PRIMARY] -END -GO -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[PopulateUserTable_P]') AND type in (N'P', N'PC')) -BEGIN -EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[PopulateUserTable_P] -@howmuch INT -AS -BEGIN - -- Fill the table variable with the rows for your result set - DECLARE @i INT - SET @i = 0 - WHILE (@i < @howmuch) - BEGIN - SET @i = @i + 1 - INSERT [Users]([name], [username]) - VALUES(''User '' + CAST(@i AS VARCHAR(10)), ''Username '' + CAST(@i AS VARCHAR(10))) - END -END -' -END -GO -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[OpenCrsr_P]') AND type in (N'P', N'PC')) -BEGIN -EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[OpenCrsr_P] -@howmuch INT, -@OutCrsr CURSOR VARYING OUTPUT -AS -BEGIN - SET @OutCrsr = CURSOR FOR - SELECT TOP (@howmuch) [name], [username], [userid] - FROM [Users]; - - OPEN @OutCrsr; -END -' -END -GO -SET ANSI_NULLS ON -GO -SET QUOTED_IDENTIFIER ON -GO -IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DeleteUserTable_P]') AND type in (N'P', N'PC')) -BEGIN -EXEC dbo.sp_executesql @statement = N'CREATE PROCEDURE [dbo].[DeleteUserTable_P] -AS -DELETE [Users]; -' -END -GO - -CREATE PROCEDURE [dbo].[TestProc2] - @iddocument int, - @iddestination_user int -as -declare @errorsave int - -set @errorsave = 0 - -if (@iddocument < 100) -begin - set @errorsave = 53120 - raiserror(@errorsave, 15, 1, 'Custom error message') - return @errorsave -end -go - -exec sp_addmessage @msgnum = 53120, @severity=1, @msgtext = 'test user defined error msg' - -GO -CREATE procedure [dbo].[ListUsers_P] @howmuch int AS -BEGIN -select top (@howmuch) * from users order by userid -END; -GO - -create procedure MultiplyIO(@factor int, @val int output) as -begin - set @val = @factor*@val; -end; - -GO - -create procedure TestDecimal -@inParam decimal(15, 8), -@copyOfInParam decimal(15, 8) out, -@constOutParam decimal(15, 8) out -as -begin -set @copyOfInParam = @inParam -set @constOutParam = 123.456; -end; - -GO - -Create procedure TestReturn -@inParam int -as -begin - return @inParam -end -GO - -alter PROC up_vb - @vb varbinary(16) -as - select cast(0x1020304050 as varbinary(16)) as d2 -GO \ No newline at end of file diff --git a/source/dbfitTest/dbfitTest.csproj b/source/dbfitTest/dbfitTest.csproj deleted file mode 100644 index ae79b379..00000000 --- a/source/dbfitTest/dbfitTest.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - Library - net48;net6.0;net6.0-windows;net7.0;net7.0-windows;net8.0;net8.0-windows - fitSharp.Test - false - false - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/source/dbfitTest/packages.config b/source/dbfitTest/packages.config deleted file mode 100644 index f132ab27..00000000 --- a/source/dbfitTest/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/source/fit/fit.csproj b/source/fit/fit.csproj index ba1a93ed..e91a59f9 100644 --- a/source/fit/fit.csproj +++ b/source/fit/fit.csproj @@ -1,6 +1,6 @@  - net48;net6.0;net6.0-windows;net7.0;net7.0-windows;net8.0;net8.0-windows + net48;net8.0;net8.0-windows;net9.0;net9.0-windows false false diff --git a/source/fit/fitL.csproj b/source/fit/fitL.csproj index a783b0a0..cb48458f 100644 --- a/source/fit/fitL.csproj +++ b/source/fit/fitL.csproj @@ -1,6 +1,6 @@  - net6.0 + net8.0 false false fit diff --git a/source/fitSharp/Machine/Application/Shell.cs b/source/fitSharp/Machine/Application/Shell.cs index 4f1da01a..f28430c7 100644 --- a/source/fitSharp/Machine/Application/Shell.cs +++ b/source/fitSharp/Machine/Application/Shell.cs @@ -28,8 +28,10 @@ public Shell(ProgressReporter progressReporter, ShellArguments arguments) { public Runnable Runner { get; private set; } public int Run() { - try { - return arguments.LoadMemory().Select(ReportError, RunInDomain); + try + { + int r = arguments.LoadMemory().Select(ReportError, RunInDomain); + return r; } catch (System.Exception e) { progressReporter.WriteLine(e.ToString()); diff --git a/source/fitSharp/fitSharp.csproj b/source/fitSharp/fitSharp.csproj index b9d265ff..844f5497 100644 --- a/source/fitSharp/fitSharp.csproj +++ b/source/fitSharp/fitSharp.csproj @@ -2,7 +2,7 @@ false false - net48;net6.0;net6.0-windows;net7.0;net7.0-windows;net8.0;net8.0-windows + net48;net8.0;net8.0-windows;net9.0;net9.0-windows diff --git a/source/fitSharp/fitSharpL.csproj b/source/fitSharp/fitSharpL.csproj index 9b99a451..e5416bb0 100644 --- a/source/fitSharp/fitSharpL.csproj +++ b/source/fitSharp/fitSharpL.csproj @@ -1,6 +1,6 @@  - net6.0 + net8.0 false false fitSharp diff --git a/source/fitSharpTest/NUnit/Fit/BindingFactoryTest.cs b/source/fitSharpTest/NUnit/Fit/BindingFactoryTest.cs index c2d89c5b..d29b4eb2 100644 --- a/source/fitSharpTest/NUnit/Fit/BindingFactoryTest.cs +++ b/source/fitSharpTest/NUnit/Fit/BindingFactoryTest.cs @@ -7,44 +7,45 @@ using fitSharp.Fit.Service; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class BindingFactoryTest { [Test] public void BindsNoActionForEmptyString() { - Assert.IsTrue(Bind(string.Empty) is NoBinding); + ClassicAssert.IsTrue(Bind(string.Empty) is NoBinding); } [Test] public void BindsCheckForQuestionSuffix() { - Assert.IsTrue(Bind("stuff?") is CheckBinding); + ClassicAssert.IsTrue(Bind("stuff?") is CheckBinding); } [Test] public void BindsCheckForExclamationSuffix() { - Assert.IsTrue(Bind("stuff!") is CheckBinding); + ClassicAssert.IsTrue(Bind("stuff!") is CheckBinding); } [Test] public void BindsCheckForParenthesesSuffix() { - Assert.IsTrue(Bind("stuff()") is CheckBinding); + ClassicAssert.IsTrue(Bind("stuff()") is CheckBinding); } [Test] public void BindsInputForPlainString() { - Assert.IsTrue(Bind("stuff") is InputBinding); + ClassicAssert.IsTrue(Bind("stuff") is InputBinding); } [Test] public void BindsCreateForNewPrefix() { - Assert.IsTrue(Bind("new stuff") is CreateBinding); + ClassicAssert.IsTrue(Bind("new stuff") is CreateBinding); } [Test] public void BindsInputForNewPrefixWithoutSpace() { - Assert.IsTrue(Bind("newstuff") is InputBinding); + ClassicAssert.IsTrue(Bind("newstuff") is InputBinding); } [Test] public void BindsCheckForNewPrefixAndQuestionSuffix() { - Assert.IsTrue(Bind("new stuff?") is CheckBinding); + ClassicAssert.IsTrue(Bind("new stuff?") is CheckBinding); } [Test] public void BindsInputForNewPrefixOnMemberName() { - Assert.IsTrue(Bind("new member") is InputBinding); + ClassicAssert.IsTrue(Bind("new member") is InputBinding); } static BindingOperation Bind(string input) { diff --git a/source/fitSharpTest/NUnit/Fit/CellOperationDefaultTest.cs b/source/fitSharpTest/NUnit/Fit/CellOperationDefaultTest.cs index 83d802a9..13315d4c 100644 --- a/source/fitSharpTest/NUnit/Fit/CellOperationDefaultTest.cs +++ b/source/fitSharpTest/NUnit/Fit/CellOperationDefaultTest.cs @@ -9,6 +9,7 @@ using fitSharp.Machine.Model; using Moq; using NUnit.Framework; +using NUnit.Framework.Legacy; using TestStatus=fitSharp.Fit.Model.TestStatus; namespace fitSharp.Test.NUnit.Fit { @@ -25,46 +26,46 @@ [TestFixture] public class CellOperationDefaultTest { [Test] public void MethodIsInvoked() { SetUpSUT("member"); - Assert.AreEqual(result, ExecuteWithNoTargetCell()); + ClassicAssert.AreEqual(result, ExecuteWithNoTargetCell()); } [Test] public void LastStatusIsClearedWhenMethodIsInvoked() { SetUpSUT("member"); testStatus.LastAction = "blah blah"; ExecuteWithNoTargetCell(); - Assert.IsNull(testStatus.LastAction); + ClassicAssert.IsNull(testStatus.LastAction); } [Test] public void LastActionIsSetAsInvokeCellAttribute() { SetUpSUT("procedure"); Execute(targetCell); - Assert.AreEqual("blah blah", targetCell.Value.GetAttribute(CellAttribute.Folded)); + ClassicAssert.AreEqual("blah blah", targetCell.Value.GetAttribute(CellAttribute.Folded)); } [Test] public void CellIsMarkedWithInvokeStatus() { SetUpSUT("procedure"); testStatus.Counts.AddCount(TestStatus.Wrong); Execute(targetCell); - Assert.AreEqual(TestStatus.Right, targetCell.Value.GetAttribute(CellAttribute.Status)); + ClassicAssert.AreEqual(TestStatus.Right, targetCell.Value.GetAttribute(CellAttribute.Status)); } [Test] public void CellIsNotMarkedIfAlreadyMarked() { SetUpSUT("procedure"); targetCell.Value.SetAttribute(CellAttribute.Status, TestStatus.Wrong); Execute(targetCell); - Assert.AreEqual(TestStatus.Wrong, targetCell.Value.GetAttribute(CellAttribute.Status)); + ClassicAssert.AreEqual(TestStatus.Wrong, targetCell.Value.GetAttribute(CellAttribute.Status)); } [Test] public void LastActionIsSetAsInputCellAttribute() { SetUpSUT("procedure"); Execute(targetCell); - Assert.AreEqual("blah blah", targetCell.Value.GetAttribute(CellAttribute.Folded)); + ClassicAssert.AreEqual("blah blah", targetCell.Value.GetAttribute(CellAttribute.Folded)); } [Test] public void LastActionIsSetAsExpectedCellAttribute() { SetUpSUT("procedure"); check.Check(CellOperationValue.Make(target.Value, new CellTreeLeaf("procedure"), new CellTree(), false), targetCell); - Assert.AreEqual("blah blah", targetCell.Value.GetAttribute(CellAttribute.Folded)); + ClassicAssert.AreEqual("blah blah", targetCell.Value.GetAttribute(CellAttribute.Folded)); } TypedValue ExecuteWithNoTargetCell() { diff --git a/source/fitSharpTest/NUnit/Fit/CellOperatorsTest.cs b/source/fitSharpTest/NUnit/Fit/CellOperatorsTest.cs index 87fab9cc..3f593107 100644 --- a/source/fitSharpTest/NUnit/Fit/CellOperatorsTest.cs +++ b/source/fitSharpTest/NUnit/Fit/CellOperatorsTest.cs @@ -8,6 +8,7 @@ using fitSharp.Machine.Engine; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { public class TestOperator : CellOperator, ParseOperator { @@ -25,13 +26,13 @@ [Test] public void LoadsOperatorByName() { var operators = new CellOperators(); operators.Add("ParseDate"); operators.Do>(o => (o is ParseDate), o => {}); - Assert.IsTrue(true, "no exception"); + ClassicAssert.IsTrue(true, "no exception"); } [Test] public void FindsWrapOperator() { var operators = new CellOperators(); var result = operators.FindOperator(new object[] {null}); - Assert.AreEqual(typeof(WrapDefault), result.GetType()); + ClassicAssert.AreEqual(typeof(WrapDefault), result.GetType()); } [Test] public void AddedFirstGetsExecutedFirst() { @@ -41,7 +42,7 @@ [Test] public void AddedFirstGetsExecutedFirst() { ParseOperator executed = null; operators.Do>(o => true, o => { executed = o; }); - Assert.AreSame(registered, executed); + ClassicAssert.AreSame(registered, executed); } } } diff --git a/source/fitSharpTest/NUnit/Fit/CellProcessorBaseTest.cs b/source/fitSharpTest/NUnit/Fit/CellProcessorBaseTest.cs index 61b6d955..c69eee79 100644 --- a/source/fitSharpTest/NUnit/Fit/CellProcessorBaseTest.cs +++ b/source/fitSharpTest/NUnit/Fit/CellProcessorBaseTest.cs @@ -10,6 +10,7 @@ using fitSharp.Machine.Model; using fitSharp.Samples.Fit; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class CellProcessorBaseTest { @@ -18,24 +19,24 @@ [Test] public void CachesParsedValue() { var processor = Builder.CellProcessor(); processor.Get().Save("symbol", "value"); TypedValue result = processor.Parse(typeof (string), TypedValue.Void, cell); - Assert.AreEqual("value", result.GetValue()); - Assert.AreEqual(" value", cell.Value.GetAttribute(CellAttribute.InformationSuffix)); + ClassicAssert.AreEqual("value", result.GetValue()); + ClassicAssert.AreEqual(" value", cell.Value.GetAttribute(CellAttribute.InformationSuffix)); processor.Parse(typeof (string), TypedValue.Void, cell); - Assert.AreEqual(" value", cell.Value.GetAttribute(CellAttribute.InformationSuffix)); - Assert.AreEqual("value", result.GetValue()); + ClassicAssert.AreEqual(" value", cell.Value.GetAttribute(CellAttribute.InformationSuffix)); + ClassicAssert.AreEqual("value", result.GetValue()); } [Test] public void WrapsValue() { var processor = Builder.CellProcessor(); var result = processor.Operate(new TypedValue("hi")); - Assert.AreEqual("hi", result.ValueString); + ClassicAssert.AreEqual("hi", result.ValueString); } [Test] public void UsesCreateOperator() { var processor = Builder.CellProcessor(); processor.AddOperator(new TestCreateOperator()); var result = processor.Create("testname"); - Assert.AreEqual("mytestname", result.GetValueAs()); + ClassicAssert.AreEqual("mytestname", result.GetValueAs()); } class TestCreateOperator: CellOperator, CreateOperator { diff --git a/source/fitSharpTest/NUnit/Fit/CompareDefaultTest.cs b/source/fitSharpTest/NUnit/Fit/CompareDefaultTest.cs index 62a117a5..76a30b68 100644 --- a/source/fitSharpTest/NUnit/Fit/CompareDefaultTest.cs +++ b/source/fitSharpTest/NUnit/Fit/CompareDefaultTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2013 Syterra Software Inc. All rights reserved. +// Copyright � 2013 Syterra Software Inc. All rights reserved. // The use and distribution terms for this software are covered by the Common Public License 1.0 (http://opensource.org/licenses/cpl.php) // which can be found in the file license.txt at the root of this distribution. By using this software in any fashion, you are agreeing // to be bound by the terms of this license. You must not remove this notice, or any other, from this software. @@ -9,6 +9,7 @@ using fitSharp.Machine.Model; using NUnit.Framework; using fitSharp.Samples.Fit; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] @@ -22,52 +23,52 @@ [SetUp] public void SetUp() { [Test] public void TestBooleanSymbol() { processor.Memory.GetItem().Save("truth", "True"); - Assert.IsTrue(AreEqual(true, "< { diff --git a/source/fitSharpTest/NUnit/Fit/ConfigureFixtureTest.cs b/source/fitSharpTest/NUnit/Fit/ConfigureFixtureTest.cs index 17c2dd20..93943af7 100644 --- a/source/fitSharpTest/NUnit/Fit/ConfigureFixtureTest.cs +++ b/source/fitSharpTest/NUnit/Fit/ConfigureFixtureTest.cs @@ -9,6 +9,7 @@ using fitSharp.Machine.Model; using fitSharp.Samples.Fit; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class ConfigureFixtureTest { @@ -24,12 +25,12 @@ [Test] public void InvokesMethodOnConfigurationItem() { fixture.Interpret(processor, MakeTable("logging", "start")); var item = processor.Configuration.GetItem(); item.WriteItem("stuff"); - Assert.AreEqual("
  • stuff
", item.Show); + ClassicAssert.AreEqual("
  • stuff
", item.Show); } [Test] public void InvokesMethodWithParameters() { fixture.Interpret(processor, new CellTree(new CellTree("configure", "symbols", "save value of System.String", "mysymbol", "", "myvalue"))); - Assert.AreEqual("myvalue", processor.Memory.GetItem().GetValue("mysymbol")); + ClassicAssert.AreEqual("myvalue", processor.Memory.GetItem().GetValue("mysymbol")); } static CellTree MakeTable(string facility, string method) { @@ -40,19 +41,19 @@ [Test] public void DisplaysResultInTable() { processor.Memory.GetItem().Save("mysymbol", "myvalue"); var table = new CellTree(new CellTree("configure", "symbols", "getvalue", "mysymbol")); fixture.Interpret(processor, table); - Assert.AreEqual("myvalue", table.ValueAt(0, 2).GetAttribute(CellAttribute.Folded)); + ClassicAssert.AreEqual("myvalue", table.ValueAt(0, 2).GetAttribute(CellAttribute.Folded)); } [Test] public void InvokesMethodOnProcessor() { var table = MakeTable("processor", "teststatus"); fixture.Interpret(processor, table); - Assert.AreEqual("fitSharp.Fit.Model.TestStatus", table.ValueAt(0, 2).GetAttribute(CellAttribute.Folded)); + ClassicAssert.AreEqual("fitSharp.Fit.Model.TestStatus", table.ValueAt(0, 2).GetAttribute(CellAttribute.Folded)); } [Test] public void InvokesMethodInEachRow() { var table = new CellTree(new CellTree("configure", "processor"), new CellTree("teststatus")); fixture.Interpret(processor, table); - Assert.AreEqual("fitSharp.Fit.Model.TestStatus", table.ValueAt(1, 0).GetAttribute(CellAttribute.Folded)); + ClassicAssert.AreEqual("fitSharp.Fit.Model.TestStatus", table.ValueAt(1, 0).GetAttribute(CellAttribute.Folded)); } } } diff --git a/source/fitSharpTest/NUnit/Fit/DeepCopyTest.cs b/source/fitSharpTest/NUnit/Fit/DeepCopyTest.cs index 5976eb19..926fdb1e 100644 --- a/source/fitSharpTest/NUnit/Fit/DeepCopyTest.cs +++ b/source/fitSharpTest/NUnit/Fit/DeepCopyTest.cs @@ -3,6 +3,7 @@ using fitSharp.Fit.Model; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] @@ -10,7 +11,7 @@ public class DeepCopyTest { [Test] public void CopiesLeaf() { - Assert.AreEqual("leaf[]", Write(copy.Make(new CellTreeLeaf("leaf")))); + ClassicAssert.AreEqual("leaf[]", Write(copy.Make(new CellTreeLeaf("leaf")))); } [Test] @@ -20,7 +21,7 @@ public void CopiesBranches() { source.AddBranchValue(new CellTreeLeaf("leafb")); var result = copy.Make(source); source.Branches[0].Add(new CellTreeLeaf("extra")); - Assert.AreEqual("root[leafa[];leafb[]]", Write(result)); + ClassicAssert.AreEqual("root[leafa[];leafb[]]", Write(result)); } [Test] @@ -32,7 +33,7 @@ public void CopiesSubstitutes() { ? new CellTree("new", "ones") : null); source.Branches[0].Add(new CellTreeLeaf("extra")); - Assert.AreEqual("root[null[new[];ones[]];leafb[]]", Write(result)); + ClassicAssert.AreEqual("root[null[new[];ones[]];leafb[]]", Write(result)); } [Test] @@ -44,7 +45,7 @@ public void DoesNotSubstituteWithinSubstitutes() { ? new CellTree("new", "leafa") : null); source.Branches[0].Add(new CellTreeLeaf("extra")); - Assert.AreEqual("root[null[new[];leafa[]];leafb[]]", Write(result)); + ClassicAssert.AreEqual("root[null[new[];leafa[]];leafb[]]", Write(result)); } [Test] @@ -53,7 +54,7 @@ public void CopiesAttributes() { source.Value.SetAttribute(CellAttribute.Label, "mylabel"); var result = copy.Make(source); source.Value.SetAttribute(CellAttribute.Label, "other"); - Assert.AreEqual("leaf,Label:mylabel[]", Write(result)); + ClassicAssert.AreEqual("leaf,Label:mylabel[]", Write(result)); } [SetUp] diff --git a/source/fitSharpTest/NUnit/Fit/DefineTest.cs b/source/fitSharpTest/NUnit/Fit/DefineTest.cs index 27e9fda0..6241d881 100644 --- a/source/fitSharpTest/NUnit/Fit/DefineTest.cs +++ b/source/fitSharpTest/NUnit/Fit/DefineTest.cs @@ -9,6 +9,7 @@ using fitSharp.Machine.Model; using fitSharp.Samples.Fit; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class DefineTest { @@ -25,7 +26,7 @@ private static void TestDefine(Tree defineRow) { var define = new Define(); var input = new CellTree(defineRow, new CellTree("stuff")); define.Interpret(processor, input); - Assert.AreEqual(input, processor.Get().GetValue("myprocedure")); + ClassicAssert.AreEqual(input, processor.Get().GetValue("myprocedure")); } } diff --git a/source/fitSharpTest/NUnit/Fit/FindMemberPatternTest.cs b/source/fitSharpTest/NUnit/Fit/FindMemberPatternTest.cs index 0474f108..9fb9b762 100644 --- a/source/fitSharpTest/NUnit/Fit/FindMemberPatternTest.cs +++ b/source/fitSharpTest/NUnit/Fit/FindMemberPatternTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2022 Syterra Software Inc. All rights reserved. +// Copyright � 2022 Syterra Software Inc. All rights reserved. // The use and distribution terms for this software are covered by the Common Public License 1.0 (http://opensource.org/licenses/cpl.php) // which can be found in the file license.txt at the root of this distribution. By using this software in any fashion, you are agreeing // to be bound by the terms of this license. You must not remove this notice, or any other, from this software. @@ -8,6 +8,7 @@ using fitSharp.Machine.Engine; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class FindMemberPatternTest { @@ -22,9 +23,9 @@ static void InvokeMemberPattern(string memberPattern, string expectedResult) { var instance = new TestClass(); var query = new MemberQuery(new MemberSpecification(new MemberName(memberPattern), 0)); var member = findMember.FindMember(new TypedValue(instance), query); - Assert.IsTrue(member.HasValueAs()); + ClassicAssert.IsTrue(member.HasValueAs()); member.GetValueAs().Invoke(new object[] {}); - Assert.AreEqual(expectedResult, instance.Field); + ClassicAssert.AreEqual(expectedResult, instance.Field); } [Test] public void MethodWithMemberPatternAttributeParsesParameters() { @@ -34,10 +35,10 @@ [Test] public void MethodWithMemberPatternAttributeParsesParameters() { [Test] public void MethodWithMisMatchedParameters() { try { InvokeMemberPattern("do math extra parameter", "I did math"); - Assert.Fail(); + ClassicAssert.Fail(); } catch (InvalidMethodException e) { - Assert.AreEqual("Member pattern for fitSharp.Test.NUnit.Fit.FindMemberPatternTest+TestClass:MisMatchedParameters(1) has 2 parameters.", e.Message); + ClassicAssert.AreEqual("Member pattern for fitSharp.Test.NUnit.Fit.FindMemberPatternTest+TestClass:MisMatchedParameters(1) has 2 parameters.", e.Message); } } diff --git a/source/fitSharpTest/NUnit/Fit/FlowRowTest.cs b/source/fitSharpTest/NUnit/Fit/FlowRowTest.cs index 6269760f..2245a03e 100644 --- a/source/fitSharpTest/NUnit/Fit/FlowRowTest.cs +++ b/source/fitSharpTest/NUnit/Fit/FlowRowTest.cs @@ -10,6 +10,7 @@ using fitSharp.Machine.Engine; using fitSharp.Machine.Model; using fitSharp.Test.Double; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] @@ -19,14 +20,14 @@ public class FlowRowTest { public void ExecutesRowMethod() { var sut = new SampleClass(); Evaluate(new CellTree("countby", "2"), sut); - Assert.AreEqual(2, sut.Count); + ClassicAssert.AreEqual(2, sut.Count); } [Test] public void ExecutesFlowKeyword() { var row = new CellTree("akeyword"); Evaluate(row, null); - Assert.AreEqual("somevalue", TestInvokeSpecialAction.Field); + ClassicAssert.AreEqual("somevalue", TestInvokeSpecialAction.Field); } static void Evaluate(Tree row, object systemUnderTest) { diff --git a/source/fitSharpTest/NUnit/Fit/GracefulNameTest.cs b/source/fitSharpTest/NUnit/Fit/GracefulNameTest.cs index fb16a228..1c1884b2 100644 --- a/source/fitSharpTest/NUnit/Fit/GracefulNameTest.cs +++ b/source/fitSharpTest/NUnit/Fit/GracefulNameTest.cs @@ -1,10 +1,11 @@ -// Copyright © 2011 Syterra Software Inc. All rights reserved. +// Copyright � 2011 Syterra Software Inc. All rights reserved. // The use and distribution terms for this software are covered by the Common Public License 1.0 (http://opensource.org/licenses/cpl.php) // which can be found in the file license.txt at the root of this distribution. By using this software in any fashion, you are agreeing // to be bound by the terms of this license. You must not remove this notice, or any other, from this software. using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class GracefulNameTest { @@ -24,7 +25,7 @@ [Test] public void TestGracefulNameConverterOnTypeName() { } static void AssertConverts(string expected, string input) { - Assert.AreEqual(expected, new GracefulName(input).IdentifierName.ToString()); + ClassicAssert.AreEqual(expected, new GracefulName(input).IdentifierName.ToString()); } [Test] public void TestConvertMemberName() { diff --git a/source/fitSharpTest/NUnit/Fit/HtmlDecoratorTest.cs b/source/fitSharpTest/NUnit/Fit/HtmlDecoratorTest.cs index 380c39f2..a49aeeaa 100644 --- a/source/fitSharpTest/NUnit/Fit/HtmlDecoratorTest.cs +++ b/source/fitSharpTest/NUnit/Fit/HtmlDecoratorTest.cs @@ -6,6 +6,7 @@ using System; using fitSharp.Fit.Runner; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] @@ -13,12 +14,12 @@ public class HtmlDecoratorTest { [Test] public void AddsTextToStart() { - Assert.AreEqual("newtext" + Environment.NewLine + "existingtext", HtmlDecorator.AddToStart("newtext", "existingtext")); + ClassicAssert.AreEqual("newtext" + Environment.NewLine + "existingtext", HtmlDecorator.AddToStart("newtext", "existingtext")); } [Test] public void AddsTextAfterDocType() { - Assert.AreEqual("" + Environment.NewLine + "newtextexistingtext", HtmlDecorator.AddToStart("newtext", "existingtext")); + ClassicAssert.AreEqual("" + Environment.NewLine + "newtextexistingtext", HtmlDecorator.AddToStart("newtext", "existingtext")); } } diff --git a/source/fitSharpTest/NUnit/Fit/IncludeTest.cs b/source/fitSharpTest/NUnit/Fit/IncludeTest.cs index cc753c3d..a533ed33 100644 --- a/source/fitSharpTest/NUnit/Fit/IncludeTest.cs +++ b/source/fitSharpTest/NUnit/Fit/IncludeTest.cs @@ -14,6 +14,7 @@ using fitSharp.Machine.Model; using fitSharp.Samples; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class IncludeTest { @@ -28,29 +29,29 @@ [Test] public void ParsesAndExecutesIncludedText() { processor.AddOperator(new MockComposeStoryTestString()); var includeTable = new CellTree(new CellTree("include", "string", input)); new Include().Interpret(processor, includeTable); - Assert.IsTrue(includeTable.ValueAt(0, 0).HasAttribute(CellAttribute.Folded)); - Assert.AreEqual(result, includeTable.ValueAt(0, 0).GetAttribute(CellAttribute.Folded)); - Assert.AreEqual(1, processor.TestStatus.Counts.GetCount(TestStatus.Right)); + ClassicAssert.IsTrue(includeTable.ValueAt(0, 0).HasAttribute(CellAttribute.Folded)); + ClassicAssert.AreEqual(result, includeTable.ValueAt(0, 0).GetAttribute(CellAttribute.Folded)); + ClassicAssert.AreEqual(1, processor.TestStatus.Counts.GetCount(TestStatus.Right)); } [Test] public void IncludesPage() { MakePage(pageName); includeAction.Page(pageName); - Assert.AreEqual(pageContent, includeAction.Result); + ClassicAssert.AreEqual(pageContent, includeAction.Result); } [Test] public void IncludesPageRelativeToCurrent() { MakePage(System.IO.Path.Combine(currentPath, pageName)); Context.TestPagePath = new FilePath(System.IO.Path.Combine(currentPath, currentPage)); includeAction.PageFromCurrent(pageName); - Assert.AreEqual(pageContent, includeAction.Result); + ClassicAssert.AreEqual(pageContent, includeAction.Result); } [Test] public void IncludesPageRelativeToSuite() { MakePage(System.IO.Path.Combine(currentPath, pageName)); Context.SuitePath = new DirectoryPath(currentPath); includeAction.PageFromSuite(pageName); - Assert.AreEqual(pageContent, includeAction.Result); + ClassicAssert.AreEqual(pageContent, includeAction.Result); } void MakePage(string pagePath) { @@ -73,7 +74,7 @@ void MakePage(string pagePath) { class MockRunTest: RunTest { public void Run(CellProcessor processor, Tree testTables, StoryTestWriter writer) { - Assert.AreSame(parsedInput, testTables); + ClassicAssert.AreSame(parsedInput, testTables); parsedInput.Value.SetAttribute(CellAttribute.Body, result); writer.WriteTable(parsedInput); processor.TestStatus.MarkRight(testTables.Branches[0].Value); @@ -86,7 +87,7 @@ public bool CanCompose(TypedValue instance) { } public Tree Compose(TypedValue instance) { - Assert.AreEqual(input, instance.ValueString); + ClassicAssert.AreEqual(input, instance.ValueString); return parsedInput; } } diff --git a/source/fitSharpTest/NUnit/Fit/InvokeFlowKeywordTest.cs b/source/fitSharpTest/NUnit/Fit/InvokeFlowKeywordTest.cs index bb38eb3f..58dee9bc 100644 --- a/source/fitSharpTest/NUnit/Fit/InvokeFlowKeywordTest.cs +++ b/source/fitSharpTest/NUnit/Fit/InvokeFlowKeywordTest.cs @@ -11,6 +11,7 @@ using fitSharp.Machine.Model; using fitSharp.Samples.Fit; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] @@ -25,32 +26,32 @@ [SetUp] public void SetUp() { [Test] public void ChecksExpectedValue() { var row = new CellTree("check", "stuff", "some stuff"); Invoke(row); - Assert.AreEqual(fitSharp.Fit.Model.TestStatus.Right, row.Last().Value.GetAttribute(CellAttribute.Status)); + ClassicAssert.AreEqual(fitSharp.Fit.Model.TestStatus.Right, row.Last().Value.GetAttribute(CellAttribute.Status)); } [Test] public void CheckFieldsForWrapsResultInList() { var row = new CellTree("check fields for", "stuff"); var result = Invoke(row).GetValue>(); - Assert.AreEqual(1, result.Count); - Assert.AreEqual("some stuff", result[0]); + ClassicAssert.AreEqual(1, result.Count); + ClassicAssert.AreEqual("some stuff", result[0]); } [Test] public void NameKeywordAssignsASymbol() { var row = new CellTree("name", "symbol", "stuff"); Invoke(row); - Assert.AreEqual("some stuff", processor.Get().GetValue("symbol")); + ClassicAssert.AreEqual("some stuff", processor.Get().GetValue("symbol")); } [Test] public void ShowAsKeywordComposesWithAttributes() { var row = new CellTree("show as", "raw", "stuff"); Invoke(row); - Assert.IsTrue(row.Last().Value.HasAttribute(CellAttribute.Raw)); + ClassicAssert.IsTrue(row.Last().Value.HasAttribute(CellAttribute.Raw)); } [Test] public void WaitUntilRepeatsExpectedValueCheck() { var row = new CellTree("wait until", "next count", "2"); Invoke(row); - Assert.AreEqual(fitSharp.Fit.Model.TestStatus.Right, row.Last().Value.GetAttribute(CellAttribute.Status)); + ClassicAssert.AreEqual(fitSharp.Fit.Model.TestStatus.Right, row.Last().Value.GetAttribute(CellAttribute.Status)); } [Test] public void WaitUntilRepeatsUpToLimit() { @@ -58,7 +59,7 @@ [Test] public void WaitUntilRepeatsUpToLimit() { processor.Get().Save("WaitFor.Time", 1); var row = new CellTree("wait until", "next count", "101"); Invoke(row); - Assert.AreEqual(fitSharp.Fit.Model.TestStatus.Wrong, row.Last().Value.GetAttribute(CellAttribute.Status)); + ClassicAssert.AreEqual(fitSharp.Fit.Model.TestStatus.Wrong, row.Last().Value.GetAttribute(CellAttribute.Status)); } TypedValue Invoke(CellTree row) { diff --git a/source/fitSharpTest/NUnit/Fit/InvokeLiteralTest.cs b/source/fitSharpTest/NUnit/Fit/InvokeLiteralTest.cs index 13197b5a..abefd1cf 100644 --- a/source/fitSharpTest/NUnit/Fit/InvokeLiteralTest.cs +++ b/source/fitSharpTest/NUnit/Fit/InvokeLiteralTest.cs @@ -7,6 +7,7 @@ using fitSharp.Fit.Operators; using fitSharp.Machine.Engine; using fitSharp.Machine.Model; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] @@ -79,14 +80,14 @@ public void ParsesString() { static void AssertCanInvoke(bool expected, Tree parameters) { var literal = new InvokeLiteral {Processor = Builder.CellProcessor()}; - Assert.AreEqual(expected, literal.CanInvoke(TypedValue.Void, new MemberName("string:"), parameters)); + ClassicAssert.AreEqual(expected, literal.CanInvoke(TypedValue.Void, new MemberName("string:"), parameters)); } static void AssertParses(T expected, string keyword, string parameter) { var literal = new InvokeLiteral {Processor = Builder.CellProcessor()}; var result = literal.Invoke(TypedValue.Void, new MemberName(keyword), new CellTree(parameter)); - Assert.AreEqual(typeof(T), result.Type); - Assert.AreEqual(expected, result.GetValue()); + ClassicAssert.AreEqual(typeof(T), result.Type); + ClassicAssert.AreEqual(expected, result.GetValue()); } } } diff --git a/source/fitSharpTest/NUnit/Fit/InvokeProcedureTest.cs b/source/fitSharpTest/NUnit/Fit/InvokeProcedureTest.cs index b3040c46..4238ed95 100644 --- a/source/fitSharpTest/NUnit/Fit/InvokeProcedureTest.cs +++ b/source/fitSharpTest/NUnit/Fit/InvokeProcedureTest.cs @@ -9,6 +9,7 @@ using fitSharp.Machine.Engine; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class InvokeProcedureTest { @@ -25,47 +26,47 @@ [SetUp] public void SetUp() { } [Test] public void InvokeForMembersIsntHandled() { - Assert.IsFalse(invokeProcedure.CanInvoke(TypedValue.Void, new MemberName("member"), new CellTree())); + ClassicAssert.IsFalse(invokeProcedure.CanInvoke(TypedValue.Void, new MemberName("member"), new CellTree())); } [Test] public void InvokeForProceduresIsHandled() { cellProcessor.Get().Save("procedure", new CellTree()); - Assert.IsTrue(invokeProcedure.CanInvoke(TypedValue.Void, new MemberName("procedure"), new CellTree())); + ClassicAssert.IsTrue(invokeProcedure.CanInvoke(TypedValue.Void, new MemberName("procedure"), new CellTree())); } [Test] public void ProcedureIsExecuted() { cellProcessor.Get().Save("procedure", new CellTree(new CellTree("define", "procedure"), new CellTree("settext"))); var sample = new Sample(); invokeProcedure.Invoke(new TypedValue(sample), new MemberName("procedure"), new CellTree()); - Assert.AreEqual("hi", sample.Text); + ClassicAssert.AreEqual("hi", sample.Text); } [Test] public void ProcedureInNestedTableIsExecuted() { cellProcessor.Get().Save("procedure", new CellTree(new CellTree("define", "procedure"), new CellTree(new CellTree(new CellTree(new CellTree("settext")))))); var sample = new Sample(); invokeProcedure.Invoke(new TypedValue(sample), new MemberName("procedure"), new CellTree()); - Assert.AreEqual("hi", sample.Text); + ClassicAssert.AreEqual("hi", sample.Text); } [Test] public void ProcedureExecutionIsLogged() { cellProcessor.Get().Save("procedure", Builder.ParseHtmlTable(noParameterProcedureHtml)); var sample = new Sample(); invokeProcedure.Invoke(new TypedValue(sample), new MemberName("procedure"), new CellTree()); - Assert.AreEqual("
settext
", cellProcessor.TestStatus.LastAction); + ClassicAssert.AreEqual("
settext
", cellProcessor.TestStatus.LastAction); } [Test] public void ProcedureIsExecutedOnACopyOfBody() { cellProcessor.Get().Save("procedure", Builder.ParseHtmlTable(errorProcedureHtml)); var sample = new Sample(); invokeProcedure.Invoke(new TypedValue(sample), new MemberName("procedure"), new CellTree()); - Assert.AreEqual(errorProcedureHtml, ((Tree)cellProcessor.Get().GetValue("procedure")).WriteTree()); + ClassicAssert.AreEqual(errorProcedureHtml, ((Tree)cellProcessor.Get().GetValue("procedure")).WriteTree()); } [Test] public void ParameterValueIsSubstituted() { cellProcessor.Get().Save("procedure", new CellTree(new CellTree("define", "procedure", "parm"), new CellTree("settext", "parm"))); var sample = new Sample(); invokeProcedure.Invoke(new TypedValue(sample), new MemberName("procedure"), new CellTree("actual")); - Assert.AreEqual("actual", sample.Text); + ClassicAssert.AreEqual("actual", sample.Text); } [Test] public void TwoParameterValuesAreSubstituted() { @@ -74,7 +75,7 @@ [Test] public void TwoParameterValuesAreSubstituted() { new CellTree(new CellTree("define", "procedure", "parm1", "", "parm2"), new CellTree("settext", "parm1", "", "parm2"))); var sample = new Sample(); invokeProcedure.Invoke(new TypedValue(sample), new MemberName("procedure"), new CellTree("actual1", "actual2")); - Assert.AreEqual("actual1actual2", sample.Text); + ClassicAssert.AreEqual("actual1actual2", sample.Text); } class Sample { diff --git a/source/fitSharpTest/NUnit/Fit/ParseByteArrayTest.cs b/source/fitSharpTest/NUnit/Fit/ParseByteArrayTest.cs index 1dc0273a..9f63559e 100644 --- a/source/fitSharpTest/NUnit/Fit/ParseByteArrayTest.cs +++ b/source/fitSharpTest/NUnit/Fit/ParseByteArrayTest.cs @@ -8,6 +8,7 @@ using fitSharp.Machine.Model; using fitSharp.Samples.Fit; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class ParseByteArrayTest { @@ -27,9 +28,9 @@ public void ParsesHexStringWithLeadingAndTrailingWhitespace() { static void CheckParse(string input, byte[] expected) { var parser = new ParseByteArray { Processor = Builder.CellProcessor() }; - Assert.IsTrue(parser.CanParse(typeof (byte[]), TypedValue.Void, new CellTreeLeaf(input))); + ClassicAssert.IsTrue(parser.CanParse(typeof (byte[]), TypedValue.Void, new CellTreeLeaf(input))); TypedValue result = parser.Parse(typeof (byte[]), TypedValue.Void, new CellTreeLeaf(input)); - Assert.AreEqual(expected, result.Value); + ClassicAssert.AreEqual(expected, result.Value); } } } diff --git a/source/fitSharpTest/NUnit/Fit/ParseDateTest.cs b/source/fitSharpTest/NUnit/Fit/ParseDateTest.cs index 3fff8347..66ec52f8 100644 --- a/source/fitSharpTest/NUnit/Fit/ParseDateTest.cs +++ b/source/fitSharpTest/NUnit/Fit/ParseDateTest.cs @@ -9,6 +9,7 @@ using fitSharp.Machine.Engine; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class ParseDateTest { @@ -22,7 +23,7 @@ [SetUp] public void SetUp() { } [Test] public void NonDateIsNotParsed() { - Assert.IsFalse(TryParse(typeof(string), "today")); + ClassicAssert.IsFalse(TryParse(typeof(string), "today")); } bool TryParse(Type type, string expected) { @@ -41,52 +42,52 @@ bool TryParse(Type type, string expected) { } [Test] public void DateWithoutKeywordIsNotParsed() { - Assert.IsFalse(TryParse(typeof(DateTime), "whenever")); + ClassicAssert.IsFalse(TryParse(typeof(DateTime), "whenever")); } [Test] public void DateMatchesKeyword() { - Assert.IsTrue(TryParse(typeof(DateTime), "today")); - Assert.AreEqual(DateTime.Now.Date, result); + ClassicAssert.IsTrue(TryParse(typeof(DateTime), "today")); + ClassicAssert.AreEqual(DateTime.Now.Date, result); } [Test] public void DateMatchesMixedCaseKeyword() { - Assert.IsTrue(TryParse(typeof(DateTime), "ToDaY")); - Assert.AreEqual(DateTime.Now.Date, result); + ClassicAssert.IsTrue(TryParse(typeof(DateTime), "ToDaY")); + ClassicAssert.AreEqual(DateTime.Now.Date, result); } [Test] public void DateMatchesKeywordWithWhitespace() { - Assert.IsTrue(TryParse(typeof(DateTime), "\r\n\t today\r\n\t ")); - Assert.AreEqual(DateTime.Now.Date, result); + ClassicAssert.IsTrue(TryParse(typeof(DateTime), "\r\n\t today\r\n\t ")); + ClassicAssert.AreEqual(DateTime.Now.Date, result); } [Test] public void DaysAreAdded() { - Assert.IsTrue(TryParse(typeof(DateTime), "today+1")); - Assert.AreEqual(DateTime.Now.Date.AddDays(1), result); + ClassicAssert.IsTrue(TryParse(typeof(DateTime), "today+1")); + ClassicAssert.AreEqual(DateTime.Now.Date.AddDays(1), result); } [Test] public void DaysAreSubtracted() { - Assert.IsTrue(TryParse(typeof(DateTime), "today-2")); - Assert.AreEqual(DateTime.Now.Date.AddDays(-2), result); + ClassicAssert.IsTrue(TryParse(typeof(DateTime), "today-2")); + ClassicAssert.AreEqual(DateTime.Now.Date.AddDays(-2), result); } [Test] public void SymbolIsParsed() { parseDate.Processor.Get().Save("two", 2); - Assert.IsTrue(TryParse(typeof(DateTime), "today-< { [Test] public void CanParse() { - Assert.IsTrue(CanParse("null"), "null"); - Assert.IsTrue(CanParse("\r\n null \r\n\t"), "null with whitespace"); - Assert.IsFalse(CanParse("not null"), "not null"); - Assert.IsFalse(CanParse("null"), "non-array"); + ClassicAssert.IsTrue(CanParse("null"), "null"); + ClassicAssert.IsTrue(CanParse("\r\n null \r\n\t"), "null with whitespace"); + ClassicAssert.IsFalse(CanParse("not null"), "not null"); + ClassicAssert.IsFalse(CanParse("null"), "non-array"); } [Test] public void ParseAlwaysReturnsNull() { - Assert.IsNull(Parse("null"), "null"); - Assert.IsNull(Parse("not null"), "not null"); - Assert.IsNull(Parse("not null"), "non-array and not null"); + ClassicAssert.IsNull(Parse("null"), "null"); + ClassicAssert.IsNull(Parse("not null"), "not null"); + ClassicAssert.IsNull(Parse("not null"), "non-array and not null"); } } } diff --git a/source/fitSharpTest/NUnit/Fit/ParseNullTest.cs b/source/fitSharpTest/NUnit/Fit/ParseNullTest.cs index 7b35c21a..a16edd1d 100644 --- a/source/fitSharpTest/NUnit/Fit/ParseNullTest.cs +++ b/source/fitSharpTest/NUnit/Fit/ParseNullTest.cs @@ -1,25 +1,26 @@ -// Copyright © 2012 Syterra Software Inc. All rights reserved. +// Copyright � 2012 Syterra Software Inc. All rights reserved. // The use and distribution terms for this software are covered by the Common Public License 1.0 (http://opensource.org/licenses/cpl.php) // which can be found in the file license.txt at the root of this distribution. By using this software in any fashion, you are agreeing // to be bound by the terms of this license. You must not remove this notice, or any other, from this software. using NUnit.Framework; using fitSharp.Fit.Operators; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class ParseNullTest : ParseOperatorTest { [Test] public void CanParse() { - Assert.IsTrue(CanParse("null"), "null"); - Assert.IsTrue(CanParse("NULL"), "NULL"); - Assert.IsTrue(CanParse("\r\n null \r\n\t"), "null with whitespace"); - Assert.IsFalse(CanParse("not null"), "not null"); + ClassicAssert.IsTrue(CanParse("null"), "null"); + ClassicAssert.IsTrue(CanParse("NULL"), "NULL"); + ClassicAssert.IsTrue(CanParse("\r\n null \r\n\t"), "null with whitespace"); + ClassicAssert.IsFalse(CanParse("not null"), "not null"); } [Test] public void ParseAlwaysReturnsNull() { - Assert.IsNull(Parse("null"), "null"); - Assert.IsNull(Parse("not null"), "not null"); + ClassicAssert.IsNull(Parse("null"), "null"); + ClassicAssert.IsNull(Parse("not null"), "not null"); } } } diff --git a/source/fitSharpTest/NUnit/Fit/ParseQuotedStringTest.cs b/source/fitSharpTest/NUnit/Fit/ParseQuotedStringTest.cs index e190f132..89ea4431 100644 --- a/source/fitSharpTest/NUnit/Fit/ParseQuotedStringTest.cs +++ b/source/fitSharpTest/NUnit/Fit/ParseQuotedStringTest.cs @@ -5,22 +5,23 @@ using NUnit.Framework; using fitSharp.Fit.Operators; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class ParseQuotedStringTest : ParseOperatorTest { [Test] public void CanParse() { - Assert.IsTrue(CanParse("'quoted'"), "'quoted'"); - Assert.IsTrue(CanParse("\r\n'quoted with whitespace' "), "\r\n'quoted with whitespace' "); - Assert.IsFalse(CanParse("'half-quoted"), "'half-quoted"); - Assert.IsFalse(CanParse("half-quoted'"), "half-quoted'"); - Assert.IsFalse(CanParse("unquoted"), "unquoted"); - Assert.IsFalse(CanParse("'1'"), "non-string"); + ClassicAssert.IsTrue(CanParse("'quoted'"), "'quoted'"); + ClassicAssert.IsTrue(CanParse("\r\n'quoted with whitespace' "), "\r\n'quoted with whitespace' "); + ClassicAssert.IsFalse(CanParse("'half-quoted"), "'half-quoted"); + ClassicAssert.IsFalse(CanParse("half-quoted'"), "half-quoted'"); + ClassicAssert.IsFalse(CanParse("unquoted"), "unquoted"); + ClassicAssert.IsFalse(CanParse("'1'"), "non-string"); } [Test] public void ParseStripsQuotes() { - Assert.AreEqual("content", Parse("'content'")); - Assert.AreEqual("content", Parse("\r\n\t 'content'\r\n\t ")); + ClassicAssert.AreEqual("content", Parse("'content'")); + ClassicAssert.AreEqual("content", Parse("\r\n\t 'content'\r\n\t ")); } } } diff --git a/source/fitSharpTest/NUnit/Fit/ParseSymbolTest.cs b/source/fitSharpTest/NUnit/Fit/ParseSymbolTest.cs index 786d5d2e..a1023bb4 100644 --- a/source/fitSharpTest/NUnit/Fit/ParseSymbolTest.cs +++ b/source/fitSharpTest/NUnit/Fit/ParseSymbolTest.cs @@ -8,28 +8,29 @@ using fitSharp.Machine.Engine; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class ParseSymbolTest : ParseOperatorTest { [Test] public void CanParse() { - Assert.IsTrue(CanParse("<("no<("\t<("("nosymbol<<"), "nosymbol<<"); - Assert.IsFalse(CanParse("<("<("no<("\t<("("nosymbol<<"), "nosymbol<<"); + ClassicAssert.IsFalse(CanParse("<().Save("symbol", "symbol value"); - Assert.AreEqual("symbol value", Parse("<("\t<("<("\t<().Save("symbol", 123.45d.ToString()); - Assert.AreEqual(123.45d, ParseAs("<("<(); RunTest(); - Assert.IsTrue(processor.Configuration.GetItem().IsSetUp); + ClassicAssert.IsTrue(processor.Configuration.GetItem().IsSetUp); } [Test] public void TearsDownConfiguration() { processor.Configuration.GetItem(); RunTest(); - Assert.IsTrue(processor.Configuration.GetItem().IsTearDown); + ClassicAssert.IsTrue(processor.Configuration.GetItem().IsTearDown); } void RunTest() { diff --git a/source/fitSharpTest/NUnit/Fit/StoryFileNameTest.cs b/source/fitSharpTest/NUnit/Fit/StoryFileNameTest.cs index 5776ddeb..811143b7 100644 --- a/source/fitSharpTest/NUnit/Fit/StoryFileNameTest.cs +++ b/source/fitSharpTest/NUnit/Fit/StoryFileNameTest.cs @@ -5,6 +5,7 @@ using fitSharp.Fit.Runner; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] @@ -15,7 +16,7 @@ public class StoryFileNameTest { [TestCase("abc.xls", false)] [TestCase("abc", false)] public void ChecksExcelSpreadsheetExtension(string fileName, bool expected) { - Assert.AreEqual(expected, new StoryFileName(fileName).IsExcelSpreadsheet); + ClassicAssert.AreEqual(expected, new StoryFileName(fileName).IsExcelSpreadsheet); } } } diff --git a/source/fitSharpTest/NUnit/Fit/StoryTestFileTest.cs b/source/fitSharpTest/NUnit/Fit/StoryTestFileTest.cs index 2259281d..3c51c9a8 100644 --- a/source/fitSharpTest/NUnit/Fit/StoryTestFileTest.cs +++ b/source/fitSharpTest/NUnit/Fit/StoryTestFileTest.cs @@ -12,6 +12,7 @@ using fitSharp.Machine.Application; using fitSharp.Machine.Engine; using fitSharp.Samples; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class StoryTestFileTest { @@ -41,7 +42,7 @@ [Test] public void DoesNotDecoratesWithMultipleLinks() { [Test] public void GetsContentForExcelSpreadsheet() { var file = MakeStoryTestFile("abc.xlsx"); - Assert.IsTrue(file.TestContent is ExcelStoryTestSource); + ClassicAssert.IsTrue(file.TestContent is ExcelStoryTestSource); } FolderTestModel folder; @@ -51,7 +52,7 @@ void CheckResult(string content, string expected) { var file = MakeStoryTestFile("myfile"); file.WriteTest(new PageResult("title", content, new TestCounts())); Clock.Instance = new Clock(); - Assert.AreEqual(comment + expected, folder.GetPageContent(new FilePath(System.IO.Path.Combine("output", "myfile.html")))); + ClassicAssert.AreEqual(comment + expected, folder.GetPageContent(new FilePath(System.IO.Path.Combine("output", "myfile.html")))); } StoryTestFile MakeStoryTestFile(string fileName) { diff --git a/source/fitSharpTest/NUnit/Fit/SuiteRunnerTest.cs b/source/fitSharpTest/NUnit/Fit/SuiteRunnerTest.cs index 823e0c97..1c33875e 100644 --- a/source/fitSharpTest/NUnit/Fit/SuiteRunnerTest.cs +++ b/source/fitSharpTest/NUnit/Fit/SuiteRunnerTest.cs @@ -13,6 +13,7 @@ using fitSharp.Machine.Engine; using fitSharp.Samples; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class SuiteRunnerTest { @@ -37,7 +38,7 @@ [Test] public void ExecutesSuiteTearDownLast() { var report = System.IO.Path.Combine("out", "reportIndex.html"); int tearDown = folders.GetPageContent(report).IndexOf("suiteteardown.html", StringComparison.Ordinal); int otherFile = folders.GetPageContent(report).IndexOf("zzzz.html", StringComparison.Ordinal); - Assert.IsTrue(otherFile < tearDown); + ClassicAssert.IsTrue(otherFile < tearDown); } [Test] public void SuiteSetupAndTearDownAreIncludedInDryRun() { @@ -53,7 +54,7 @@ [Test] public void SuiteSetupAndTearDownAreIncludedInDryRun() { string expected = System.IO.Path.Combine("in", "suitesetup.html") + Environment.NewLine + System.IO.Path.Combine("in", "test.html") + Environment.NewLine + System.IO.Path.Combine("in", "suiteteardown.html") + Environment.NewLine; - Assert.AreEqual(expected, reporter.Output); + ClassicAssert.AreEqual(expected, reporter.Output); } [Test] public void SetupAndTearDownAreNotIncludedInDryRun() { @@ -68,7 +69,7 @@ [Test] public void SetupAndTearDownAreNotIncludedInDryRun() { string expected = System.IO.Path.Combine("in", "test.html") + Environment.NewLine; - Assert.AreEqual(expected, reporter.Output); + ClassicAssert.AreEqual(expected, reporter.Output); } [Test] public void DryRunListsAllApplicableTestFiles() { @@ -82,7 +83,7 @@ [Test] public void DryRunListsAllApplicableTestFiles() { string expected = System.IO.Path.Combine("in", "test1.html") + Environment.NewLine + System.IO.Path.Combine("in", "test2.html") + Environment.NewLine; - Assert.AreEqual(expected, reporter.Output); + ClassicAssert.AreEqual(expected, reporter.Output); } [Test] public void DryRunDoesNotProduceAnyTestResults() { @@ -93,18 +94,18 @@ [Test] public void DryRunDoesNotProduceAnyTestResults() { RunSuite(); - Assert.IsEmpty(folders.GetFiles("out")); - Assert.IsEmpty(folders.GetFolders("out")); + ClassicAssert.IsEmpty(folders.GetFiles("out")); + ClassicAssert.IsEmpty(folders.GetFolders("out")); } [Test] public void TestPagePathIsStoredInMemoryWhenPageExecutes() { - Assert.IsNull(memory.GetItem().TestPagePath); + ClassicAssert.IsNull(memory.GetItem().TestPagePath); AddTestFile("in", "page.html"); RunSuite(); - Assert.AreEqual(System.IO.Path.Combine("in", "page.html"), memory.GetItem().TestPagePath.ToString()); + ClassicAssert.AreEqual(System.IO.Path.Combine("in", "page.html"), memory.GetItem().TestPagePath.ToString()); } [Test] @@ -115,10 +116,10 @@ public void SetupAndTearDownAreNotCopiedToOutputDirectory() { RunSuite(); - Assert.IsTrue(folders.Exists(System.IO.Path.Combine("out", "test.html")), "test.html should exist in output directory"); + ClassicAssert.IsTrue(folders.Exists(System.IO.Path.Combine("out", "test.html")), "test.html should exist in output directory"); - Assert.IsFalse(folders.Exists(System.IO.Path.Combine("out", "setup.html")), "setup.html should not exist in output directory"); - Assert.IsFalse(folders.Exists(System.IO.Path.Combine("out", "teardown.html")), "teardown.html should not exist in output directory"); + ClassicAssert.IsFalse(folders.Exists(System.IO.Path.Combine("out", "setup.html")), "setup.html should not exist in output directory"); + ClassicAssert.IsFalse(folders.Exists(System.IO.Path.Combine("out", "teardown.html")), "teardown.html should not exist in output directory"); } [Test] @@ -127,14 +128,14 @@ public void StylesheetIsCreatedInOutputDirectory() { RunSuite(); - Assert.IsTrue(folders.Exists(System.IO.Path.Combine("out", "fit.css")), "fit.css should exist in output directory"); + ClassicAssert.IsTrue(folders.Exists(System.IO.Path.Combine("out", "fit.css")), "fit.css should exist in output directory"); } [Test] public void TestInSubFolderIsRun() { AddTestFile(System.IO.Path.Combine("in", "sub"), "test.html"); RunSuite(); - Assert.IsTrue(folders.Exists(System.IO.Path.Combine("out", "sub", "test.html")), "test.html should exist in output directory"); + ClassicAssert.IsTrue(folders.Exists(System.IO.Path.Combine("out", "sub", "test.html")), "test.html should exist in output directory"); } [Test] @@ -142,8 +143,8 @@ public void SelectedTestIsRun() { AddTestFile("in", "test1.html"); AddTestFile("in", "test2.html"); RunSuite("test2.html"); - Assert.IsFalse(folders.Exists(System.IO.Path.Combine("out", "test1.html")), "test1.html should not exist in output directory"); - Assert.IsTrue(folders.Exists(System.IO.Path.Combine("out", "test2.html")), "test2.html should exist in output directory"); + ClassicAssert.IsFalse(folders.Exists(System.IO.Path.Combine("out", "test1.html")), "test1.html should not exist in output directory"); + ClassicAssert.IsTrue(folders.Exists(System.IO.Path.Combine("out", "test2.html")), "test2.html should exist in output directory"); } [Test] @@ -152,9 +153,9 @@ public void SelectedTestInSubFolderIsRun() { AddTestFile("in", "test2.html"); AddTestFile(System.IO.Path.Combine("in", "some", "sub"), "test2.html"); RunSuite(System.IO.Path.Combine("sub", "test2.html")); - Assert.IsFalse(folders.Exists(System.IO.Path.Combine("out", "test1.html")), "test1.html should not exist in out directory"); - Assert.IsFalse(folders.Exists(System.IO.Path.Combine("out", "test2.html")), "test2.html should not exist in out directory"); - Assert.IsTrue(folders.Exists(System.IO.Path.Combine("out", "some", "sub", "test2.html")), "test2.html should exist in out\\some\\sub directory"); + ClassicAssert.IsFalse(folders.Exists(System.IO.Path.Combine("out", "test1.html")), "test1.html should not exist in out directory"); + ClassicAssert.IsFalse(folders.Exists(System.IO.Path.Combine("out", "test2.html")), "test2.html should not exist in out directory"); + ClassicAssert.IsTrue(folders.Exists(System.IO.Path.Combine("out", "some", "sub", "test2.html")), "test2.html should exist in out\\some\\sub directory"); } private void RunSuite(string selectedFile = "") { diff --git a/source/fitSharpTest/NUnit/Fit/TagFilterTest.cs b/source/fitSharpTest/NUnit/Fit/TagFilterTest.cs index 4527bad1..a2626998 100644 --- a/source/fitSharpTest/NUnit/Fit/TagFilterTest.cs +++ b/source/fitSharpTest/NUnit/Fit/TagFilterTest.cs @@ -7,6 +7,7 @@ using fitSharp.Fit.Model; using NUnit.Framework; using fitSharp.Fit.Runner; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { @@ -15,106 +16,106 @@ public class TagFilterTest { [Test] public void ConstructorShouldNotAllowEmptyFilter() { - Assert.Throws(() => new TagFilter("")); + ClassicAssert.Throws(() => new TagFilter("")); } [Test] public void ConstructorShouldNotAllowNullFilter() { - Assert.Throws(() => new TagFilter(null)); + ClassicAssert.Throws(() => new TagFilter(null)); } [Test] public void MatchItemInTags() { - Assert.IsTrue(MatchesFilter(@"
Tags: A, B
", "A,B")); + ClassicAssert.IsTrue(MatchesFilter(@"
Tags: A, B
", "A,B")); } [Test] public void MatchItemInTagsWithSpaces() { - Assert.IsTrue(MatchesFilter(@"
Tags: A, B
", " A, B ")); + ClassicAssert.IsTrue(MatchesFilter(@"
Tags: A, B
", " A, B ")); } [Test] public void MatchTagWithOnlyOneTagItem() { - Assert.IsTrue(MatchesFilter(@"
Tags: B
", "B")); + ClassicAssert.IsTrue(MatchesFilter(@"
Tags: B
", "B")); } [Test] public void ShouldNotMatchItemNotInFilter() { - Assert.IsFalse(MatchesFilter(@"
Tags: B
", "B-L")); + ClassicAssert.IsFalse(MatchesFilter(@"
Tags: B
", "B-L")); } [Test] public void CaseInsensitiveIdMatch() { - Assert.IsTrue(MatchesFilter(@"
Tags: A
", "A")); + ClassicAssert.IsTrue(MatchesFilter(@"
Tags: A
", "A")); } [Test] public void CaseInsensitiveTagMatch() { - Assert.IsTrue(MatchesFilter(@"

Tags: A

", "a")); + ClassicAssert.IsTrue(MatchesFilter(@"

Tags: A

", "a")); } [Test] public void ShouldNotMatchIfNoIdAttribute() { - Assert.IsFalse(MatchesFilter(@"
Tags: A
", "A")); + ClassicAssert.IsFalse(MatchesFilter(@"
Tags: A
", "A")); } [Test] public void ShouldNotMatchContentWithoutTags() { - Assert.IsFalse(MatchesFilter(@"

Content

", "A")); + ClassicAssert.IsFalse(MatchesFilter(@"

Content

", "A")); } [Test] public void ShouldNotMatchItemUnlessIdAttributeIs_fit_tags() { - Assert.IsFalse(MatchesFilter(@"
Tags: A, B
", "A, B")); - Assert.IsFalse(MatchesFilter(@"
Tags: A, B
", "A, B")); + ClassicAssert.IsFalse(MatchesFilter(@"
Tags: A, B
", "A, B")); + ClassicAssert.IsFalse(MatchesFilter(@"
Tags: A, B
", "A, B")); } [Test] public void ShouldMatchWithoutLeadingTagsLabel() { - Assert.IsTrue(MatchesFilter(@"
A,B
", "A, B")); + ClassicAssert.IsTrue(MatchesFilter(@"
A,B
", "A, B")); } [Test] public void ShouldMatchWithParagraphElement() { - Assert.IsTrue(MatchesFilter(@"

Tags: A,B

", "A, B")); + ClassicAssert.IsTrue(MatchesFilter(@"

Tags: A,B

", "A, B")); } [Test] public void ShouldNotMatchTagSpecificationWithinComment() { - Assert.IsFalse(MatchesFilter(@"", "A, B")); + ClassicAssert.IsFalse(MatchesFilter(@"", "A, B")); } [Test] public void ShouldNotMatchPartsOfTagNames() { - Assert.IsFalse(MatchesFilter(@"

Tags: B-L

", "B")); + ClassicAssert.IsFalse(MatchesFilter(@"

Tags: B-L

", "B")); } [Test] public void AllowsFitTagsWithSingleQuotes() { - Assert.IsTrue(MatchesFilter(@"

Tags: A

", "A")); + ClassicAssert.IsTrue(MatchesFilter(@"

Tags: A

", "A")); } [Test] public void AllowsFitTagsWithoutQuotes() { - Assert.IsTrue(MatchesFilter(@"

Tags: A

", "A")); + ClassicAssert.IsTrue(MatchesFilter(@"

Tags: A

", "A")); } [Test] public void CommentedLineShouldNotMatchTag() { - Assert.IsTrue(MatchesFilter(@"", "A")); + ClassicAssert.IsTrue(MatchesFilter(@"", "A")); } [Test] public void ShouldMatchAnySubsetOfTags() { - Assert.IsTrue(MatchesFilter(@"

Tags: A,B

", "A")); + ClassicAssert.IsTrue(MatchesFilter(@"

Tags: A,B

", "A")); } [Test] public void ShouldNotMatchLessThanFilterRequires() { - Assert.IsFalse(MatchesFilter(@"

Tags: A

", "A,B")); + ClassicAssert.IsFalse(MatchesFilter(@"

Tags: A

", "A,B")); } [Test] public void ShouldMatchTagIfContentContainsTwoDivElements() { - Assert.IsTrue(MatchesFilter(@"
Tags: B
testing
", "B")); + ClassicAssert.IsTrue(MatchesFilter(@"
Tags: B
testing
", "B")); } [Test] @@ -123,35 +124,35 @@ public void ShouldHandleFormattedHtml() { @" Tags: B" + Environment.NewLine + @""; - Assert.IsTrue(MatchesFilter(html, "B")); + ClassicAssert.IsTrue(MatchesFilter(html, "B")); } [Test] public void ShouldAllowAnyTagLabel() { const string html = @"
Anything: A
"; - Assert.IsTrue(MatchesFilter(html, "A")); - Assert.IsFalse(MatchesFilter(html, "B")); + ClassicAssert.IsTrue(MatchesFilter(html, "A")); + ClassicAssert.IsFalse(MatchesFilter(html, "B")); } [Test] public void ShouldFindTagsIrrespectiveOfAttributeOrdering() { const string html = @"
Tags: A
"; - Assert.IsTrue(MatchesFilter(html, "A")); + ClassicAssert.IsTrue(MatchesFilter(html, "A")); } [Test] public void ShouldMatchWithAnyNumberOfQuotes() { - Assert.IsTrue(MatchesFilter(@"

Tags: A

", "A")); + ClassicAssert.IsTrue(MatchesFilter(@"

Tags: A

", "A")); } [Test] public void MatchWildcardAsterisk() { - Assert.IsTrue(MatchesFilter("
Tags: bike
", "bi*")); + ClassicAssert.IsTrue(MatchesFilter("
Tags: bike
", "bi*")); } [Test] public void MatchWildcardQuestionMark() { - Assert.IsTrue(MatchesFilter("
Tags: car
", "c?r")); + ClassicAssert.IsTrue(MatchesFilter("
Tags: car
", "c?r")); } private static bool MatchesFilter(string content, string tagList) { diff --git a/source/fitSharpTest/NUnit/Fit/TestStatusTest.cs b/source/fitSharpTest/NUnit/Fit/TestStatusTest.cs index b1480c8b..d8e2eee5 100644 --- a/source/fitSharpTest/NUnit/Fit/TestStatusTest.cs +++ b/source/fitSharpTest/NUnit/Fit/TestStatusTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2012 Syterra Software Inc. All rights reserved. +// Copyright � 2012 Syterra Software Inc. All rights reserved. // The use and distribution terms for this software are covered by the Common Public License 1.0 (http://opensource.org/licenses/cpl.php) // which can be found in the file license.txt at the root of this distribution. By using this software in any fashion, you are agreeing // to be bound by the terms of this license. You must not remove this notice, or any other, from this software. @@ -8,6 +8,7 @@ using fitSharp.Fit.Exception; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class TestStatusTest { @@ -21,12 +22,12 @@ [Test] public void MarkWithNestedAbandonSuiteAbandonsSuite() { static void AssertAbandonsSuite(Exception exception) { var status = new fitSharp.Fit.Model.TestStatus(); - Assert.IsFalse(status.SuiteIsAbandoned); + ClassicAssert.IsFalse(status.SuiteIsAbandoned); try { status.MarkException(new CellBase("test"), exception); } catch (AbandonSuiteException) {} - Assert.IsTrue(status.SuiteIsAbandoned); + ClassicAssert.IsTrue(status.SuiteIsAbandoned); } } } diff --git a/source/fitSharpTest/NUnit/Fit/TreeCellWriterTest.cs b/source/fitSharpTest/NUnit/Fit/TreeCellWriterTest.cs index b8d14fec..8a83fdd6 100644 --- a/source/fitSharpTest/NUnit/Fit/TreeCellWriterTest.cs +++ b/source/fitSharpTest/NUnit/Fit/TreeCellWriterTest.cs @@ -6,6 +6,7 @@ using fitSharp.Fit.Model; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { @@ -14,14 +15,14 @@ [Test] public void FoldedWithExtraTextIsFormatted() { var cell = new CellBase(string.Empty); cell.SetAttribute(CellAttribute.Body, string.Empty); cell.SetAttribute(CellAttribute.Folded, "more"); - Assert.AreEqual(FormatFolded("more"), TreeCellWriter.Body(cell)); + ClassicAssert.AreEqual(FormatFolded("more"), TreeCellWriter.Body(cell)); } [Test] public void FoldedWithoutExtraTextFormatsBody() { var cell = new CellBase(string.Empty); cell.SetAttribute(CellAttribute.Body, "stuff"); cell.SetAttribute(CellAttribute.Folded, string.Empty); - Assert.AreEqual(FormatFolded("stuff"), TreeCellWriter.Body(cell)); + ClassicAssert.AreEqual(FormatFolded("stuff"), TreeCellWriter.Body(cell)); } static string FormatFolded(string text) { diff --git a/source/fitSharpTest/NUnit/Fit/ValueArrayTest.cs b/source/fitSharpTest/NUnit/Fit/ValueArrayTest.cs index 74fa6fac..e6a0dfe2 100644 --- a/source/fitSharpTest/NUnit/Fit/ValueArrayTest.cs +++ b/source/fitSharpTest/NUnit/Fit/ValueArrayTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2011 Syterra Software Inc. All rights reserved. +// Copyright � 2011 Syterra Software Inc. All rights reserved. // The use and distribution terms for this software are covered by the Common Public License 1.0 (http://opensource.org/licenses/cpl.php) // which can be found in the file license.txt at the root of this distribution. By using this software in any fashion, you are agreeing // to be bound by the terms of this license. You must not remove this notice, or any other, from this software. @@ -8,6 +8,7 @@ using fitSharp.Fit.Model; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class ValueArrayTest { @@ -15,37 +16,37 @@ [TestFixture] public class ValueArrayTest { [Test] public void SingleRowReturnsEachCell() { var rows = new CellTree(new CellTree("aaa", "bb", "c")); var results = ProcessRows(rows.Branches); - Assert.AreEqual(3, results.Count, "count"); - Assert.AreEqual("aaa", results[0], "first"); - Assert.AreEqual("bb", results[1], "second"); - Assert.AreEqual("c", results[2], "third"); + ClassicAssert.AreEqual(3, results.Count, "count"); + ClassicAssert.AreEqual("aaa", results[0], "first"); + ClassicAssert.AreEqual("bb", results[1], "second"); + ClassicAssert.AreEqual("c", results[2], "third"); } [Test] public void MultipleRowsReturnsEachCell() { var rows = new CellTree(new CellTree("xxx"), new CellTree("aaa", "bb", "c")); var results = ProcessRows(rows.Branches); - Assert.AreEqual(3, results.Count, "count"); - Assert.AreEqual("aaa", results[0], "first"); - Assert.AreEqual("bb", results[1], "second"); - Assert.AreEqual("c", results[2], "third"); + ClassicAssert.AreEqual(3, results.Count, "count"); + ClassicAssert.AreEqual("aaa", results[0], "first"); + ClassicAssert.AreEqual("bb", results[1], "second"); + ClassicAssert.AreEqual("c", results[2], "third"); } [Test] public void RepeatKeywordReturnsPreviousValue() { var rows = new CellTree(new CellTree("xxx", "yy"), new CellTree("aaa", "ditto", "c")); var results = ProcessRows(rows.Branches); - Assert.AreEqual(3, results.Count, "count"); - Assert.AreEqual("aaa", results[0], "first"); - Assert.AreEqual("yy", results[1], "second"); - Assert.AreEqual("c", results[2], "third"); + ClassicAssert.AreEqual(3, results.Count, "count"); + ClassicAssert.AreEqual("aaa", results[0], "first"); + ClassicAssert.AreEqual("yy", results[1], "second"); + ClassicAssert.AreEqual("c", results[2], "third"); } [Test] public void RepeatKeywordWithNoPreviousValue() { var rows = new CellTree(new CellTree("xxx", "yy"), new CellTree("aaa", "bb", "ditto")); var results = ProcessRows(rows.Branches); - Assert.AreEqual(3, results.Count, "count"); - Assert.AreEqual("aaa", results[0], "first"); - Assert.AreEqual("bb", results[1], "second"); - Assert.AreEqual("ditto", results[2], "third"); + ClassicAssert.AreEqual(3, results.Count, "count"); + ClassicAssert.AreEqual("aaa", results[0], "first"); + ClassicAssert.AreEqual("bb", results[1], "second"); + ClassicAssert.AreEqual("ditto", results[2], "third"); } static IList ProcessRows(IEnumerable> theRows) { diff --git a/source/fitSharpTest/NUnit/Fit/ValuePhraseTest.cs b/source/fitSharpTest/NUnit/Fit/ValuePhraseTest.cs index c03ea47f..892e65a3 100644 --- a/source/fitSharpTest/NUnit/Fit/ValuePhraseTest.cs +++ b/source/fitSharpTest/NUnit/Fit/ValuePhraseTest.cs @@ -9,6 +9,7 @@ using fitSharp.Machine.Model; using fitSharp.Samples.Fit; using fitSharp.Test.Double; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Fit { [TestFixture] @@ -18,7 +19,7 @@ public class ValuePhraseTest { public void ReturnsSymbolValue() { var processor = Builder.CellProcessor(); processor.Get().Save("mysymbol", 123); - Assert.AreEqual(123, new ValuePhrase(new CellTree("keyword", "mysymbol")).Evaluate(processor)); + ClassicAssert.AreEqual(123, new ValuePhrase(new CellTree("keyword", "mysymbol")).Evaluate(processor)); } [Test] @@ -26,7 +27,7 @@ public void ReturnsMethodValue() { var processor = Builder.CellProcessor(); var interpreter = new DefaultFlowInterpreter(new SampleClass()); processor.CallStack.DomainAdapter = new TypedValue(interpreter); - Assert.AreEqual("samplereturn", new ValuePhrase(new CellTree("keyword", "methodnoparms")).Evaluate(processor)); + ClassicAssert.AreEqual("samplereturn", new ValuePhrase(new CellTree("keyword", "methodnoparms")).Evaluate(processor)); } } } diff --git a/source/fitSharpTest/NUnit/Fit/XmlResultWriterTest.cs b/source/fitSharpTest/NUnit/Fit/XmlResultWriterTest.cs index 1bbcb8e6..dd929794 100644 --- a/source/fitSharpTest/NUnit/Fit/XmlResultWriterTest.cs +++ b/source/fitSharpTest/NUnit/Fit/XmlResultWriterTest.cs @@ -10,6 +10,7 @@ using fitSharp.IO; using fitSharp.Samples; using NUnit.Framework; +using NUnit.Framework.Legacy; using TestStatus=fitSharp.Fit.Model.TestStatus; namespace fitSharp.Test.NUnit.Fit { @@ -31,8 +32,8 @@ public void TestCloseWithFileName() { strategy = new XmlResultWriter(testResultFileName, folderModel); strategy.Close(); - Assert.IsTrue(folderModel.Exists(testResultFileName)); - Assert.AreEqual("" + Environment.NewLine + "", folderModel.GetPageContent(testResultFileName)); + ClassicAssert.IsTrue(folderModel.Exists(testResultFileName)); + ClassicAssert.AreEqual("" + Environment.NewLine + "", folderModel.GetPageContent(testResultFileName)); } [Test] @@ -40,7 +41,7 @@ public void TestCloseWithStandardOut() { strategy = new XmlResultWriter("stdout", folderModel); strategy.Close(); - Assert.IsFalse(folderModel.Exists(testResultFileName)); + ClassicAssert.IsFalse(folderModel.Exists(testResultFileName)); } [Test] @@ -53,7 +54,7 @@ public void TestWriteResults() strategy = new XmlResultWriter(testResultFileName, folderModel); strategy.WritePageResult(pageResult); strategy.Close(); - Assert.AreEqual( + ClassicAssert.AreEqual( BuildPageResultString(pageName, "" + Environment.NewLine + "Text" + Environment.NewLine + "" + Environment.NewLine @@ -69,7 +70,7 @@ public void TestWriteIllegalCharacters() strategy = new XmlResultWriter(testResultFileName, folderModel); strategy.WritePageResult(pageResult); strategy.Close(); - Assert.AreEqual( + ClassicAssert.AreEqual( BuildPageResultString(pageName, "Text]]>", 1, 2, 3, 4), folderModel.GetPageContent(testResultFileName)); } @@ -80,7 +81,7 @@ public void TestWriteFinalCounts() strategy = new XmlResultWriter(testResultFileName, folderModel); strategy.WriteFinalCount(MakeTestCounts()); strategy.Close(); - Assert.AreEqual(BuildFinalCountsString(1, 2, 3, 4), + ClassicAssert.AreEqual(BuildFinalCountsString(1, 2, 3, 4), folderModel.GetPageContent(testResultFileName)); } diff --git a/source/fitSharpTest/NUnit/IO/ElapsedTimeTest.cs b/source/fitSharpTest/NUnit/IO/ElapsedTimeTest.cs index 284d9279..a4b26b31 100644 --- a/source/fitSharpTest/NUnit/IO/ElapsedTimeTest.cs +++ b/source/fitSharpTest/NUnit/IO/ElapsedTimeTest.cs @@ -7,6 +7,7 @@ using fitSharp.IO; using fitSharp.Samples; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.IO { [TestFixture] public class ElapsedTimeTest { @@ -14,14 +15,14 @@ [Test] public void ShortTimeIsShown() { Clock.Instance = TestClock.Instance; var elapsed = new ElapsedTime(); TestClock.Instance.Elapsed = new TimeSpan(0); - Assert.AreEqual("0.001", elapsed.ToString()); + ClassicAssert.AreEqual("0.001", elapsed.ToString()); } [Test] public void LongTimeIsShown() { Clock.Instance = TestClock.Instance; var elapsed = new ElapsedTime(); TestClock.Instance.Elapsed = new TimeSpan(0, 8763, 0, 0, 0); - Assert.AreEqual("8763:00:00.001", elapsed.ToString()); + ClassicAssert.AreEqual("8763:00:00.001", elapsed.ToString()); } } } diff --git a/source/fitSharpTest/NUnit/IO/MessageChannelTest.cs b/source/fitSharpTest/NUnit/IO/MessageChannelTest.cs index 08f9868a..75bc4d19 100644 --- a/source/fitSharpTest/NUnit/IO/MessageChannelTest.cs +++ b/source/fitSharpTest/NUnit/IO/MessageChannelTest.cs @@ -6,6 +6,7 @@ using fitSharp.IO; using fitSharp.Samples; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.IO { [TestFixture] public class MessageChannelTest { @@ -14,7 +15,7 @@ [Test] public void SimpleStringIsRead() { var testSocket = new TestPort(); var socketStream = new MessageChannel(testSocket); testSocket.PutBytes(new byte[] {104, 101, 108, 108, 111}); - Assert.AreEqual("hello", socketStream.Read(5)); + ClassicAssert.AreEqual("hello", socketStream.Read(5)); } [Test] public void StringIsReadInMultipleParts() { @@ -22,28 +23,28 @@ [Test] public void StringIsReadInMultipleParts() { var socketStream = new MessageChannel(testSocket); testSocket.PutBytes(new byte[] {104, 101, 108, 108, 111}); testSocket.PutBytes(new byte[] {32, 119,111,114,108,100}); - Assert.AreEqual("hello world", socketStream.Read(11)); + ClassicAssert.AreEqual("hello world", socketStream.Read(11)); } [Test] public void EncodedStringIsRead() { var testSocket = new TestPort(); var socketStream = new MessageChannel(testSocket); testSocket.PutBytes(new byte[] {104, 226, 128, 153, 108, 108, 111}); - Assert.AreEqual("h\u2019llo", socketStream.Read(7)); + ClassicAssert.AreEqual("h\u2019llo", socketStream.Read(7)); } [Test] public void SimpleStringIsWritten() { var testSocket = new TestPort(); var socketStream = new MessageChannel(testSocket); socketStream.Write("hello"); - Assert.AreEqual(new byte[] {104, 101, 108, 108, 111}, testSocket.GetBytes()); + ClassicAssert.AreEqual(new byte[] {104, 101, 108, 108, 111}, testSocket.GetBytes()); } [Test] public void StringIsWrittenWithLengthPrefix() { var testSocket = new TestPort(); var socketStream = new MessageChannel(testSocket); socketStream.Write("h\u2019llo", "{0}:"); - Assert.AreEqual(new byte[] {55, 58, 104, 226, 128, 153, 108, 108, 111}, testSocket.GetBytes()); + ClassicAssert.AreEqual(new byte[] {55, 58, 104, 226, 128, 153, 108, 108, 111}, testSocket.GetBytes()); } } diff --git a/source/fitSharpTest/NUnit/Machine/ApplicationUnderTestTest.cs b/source/fitSharpTest/NUnit/Machine/ApplicationUnderTestTest.cs index d9946438..280fa4b0 100644 --- a/source/fitSharpTest/NUnit/Machine/ApplicationUnderTestTest.cs +++ b/source/fitSharpTest/NUnit/Machine/ApplicationUnderTestTest.cs @@ -12,6 +12,7 @@ using fitSharp.Test.Double; using Moq; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] public class ApplicationUnderTestTest { @@ -70,7 +71,7 @@ [Test] public void NamespaceIsRemoved() { [Test] public void TypeIsFoundInLoadedAssembly() { LoadTestTarget(); var sample = GetType("fitSharp.TestTarget.SampleDomain"); - Assert.AreEqual("fitSharp.TestTarget.SampleDomain", sample.FullName); + ClassicAssert.AreEqual("fitSharp.TestTarget.SampleDomain", sample.FullName); } [Test] public void TypeIsFoundInDefaultNamespace() { @@ -89,14 +90,14 @@ [Test] public void ReloadingAssemblyIsIgnored() { LoadTestTarget(); LoadTestTarget(); var sample = GetType("fitSharp.TestTarget.SampleDomain"); - Assert.AreEqual("fitSharp.TestTarget.SampleDomain", sample.FullName); + ClassicAssert.AreEqual("fitSharp.TestTarget.SampleDomain", sample.FullName); } [Test] public void JarFilesAreIgnored() { SetUpMockDomain(); applicationUnderTest.AddAssembly("testtarget.jAr"); domain.Verify(d => d.LoadAssembly(It.IsAny()), Times.Never()); - Assert.IsTrue(true); + ClassicAssert.IsTrue(true); } [Test] @@ -104,7 +105,7 @@ public void LoadsFromAlternateFolder() { AssemblyLoadFailureHandler.AddFolder(Path.Combine(TargetPath(), "build/sample/TestTarget".AsPath())); LoadTarget("TestTarget2"); var type = applicationUnderTest.FindType("fitSharp.TestTarget2.SampleWithDependency"); - Assert.AreEqual("my sample says hi sample", new RuntimeType(type).CreateInstance().ValueString); + ClassicAssert.AreEqual("my sample says hi sample", new RuntimeType(type).CreateInstance().ValueString); } void SetUpMockDomain() { @@ -128,7 +129,7 @@ [Test] public void OptionalAssemblyIgnoresMissingAssembly() { SetUpMockDomain(); domain.Setup(d => d.LoadAssembly("myassembly.dll")).Throws(new FileNotFoundException()); applicationUnderTest.AddOptionalAssembly("myassembly.dll"); - Assert.IsTrue(true); + ClassicAssert.IsTrue(true); } void ExpectFitAssemblyIsLoaded() { @@ -148,7 +149,7 @@ [Test] public void FitAssemblyIsLoadedForFitNamespace() { void CheckTypeFound(string typeName) { var sample = GetType(typeName); - Assert.AreEqual(typeof(T), sample); + ClassicAssert.AreEqual(typeof(T), sample); } void CheckTypeNotFound(string typeName) { @@ -159,7 +160,7 @@ void CheckTypeNotFound(string typeName) { catch (Exception e) { message = e.Message; } - Assert.IsTrue(message.StartsWith("Type 'SampleClass' not found in assemblies")); + ClassicAssert.IsTrue(message.StartsWith("Type 'SampleClass' not found in assemblies")); } Type GetType(string name) { diff --git a/source/fitSharpTest/NUnit/Machine/ArgumentParserTest.cs b/source/fitSharpTest/NUnit/Machine/ArgumentParserTest.cs index 5daa1826..8c88de04 100644 --- a/source/fitSharpTest/NUnit/Machine/ArgumentParserTest.cs +++ b/source/fitSharpTest/NUnit/Machine/ArgumentParserTest.cs @@ -6,6 +6,7 @@ using fitSharp.Machine.Application; using NUnit.Framework; using System.Collections.Generic; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] public class ArgumentParserTest { @@ -63,7 +64,7 @@ [Test] public void ParseSwitchHandlerAsArgument() { [Test] public void CollectsExtras() { - Assert.AreEqual("x,-a,-b,b", string.Join(",", + ClassicAssert.AreEqual("x,-a,-b,b", string.Join(",", ArgumentParser.Extras(new [] {"x", "-a", "-x", "a", "-x", "-b", "b", "-y"}, new [] {"x", "y"}))); } @@ -80,8 +81,8 @@ void AddArgumentHandler(string @switch) { void AssertParse(string[] input, string[] expectedInvoked) { parser.Parse(input); - Assert.AreEqual(expectedInvoked.Length, itemsInvoked.Count); - foreach(var expected in expectedInvoked) Assert.IsTrue(itemsInvoked.Contains(expected)); + ClassicAssert.AreEqual(expectedInvoked.Length, itemsInvoked.Count); + foreach(var expected in expectedInvoked) ClassicAssert.IsTrue(itemsInvoked.Contains(expected)); } } } diff --git a/source/fitSharpTest/NUnit/Machine/BreakTest.cs b/source/fitSharpTest/NUnit/Machine/BreakTest.cs index 6589b0cb..86999980 100644 --- a/source/fitSharpTest/NUnit/Machine/BreakTest.cs +++ b/source/fitSharpTest/NUnit/Machine/BreakTest.cs @@ -6,6 +6,7 @@ using System; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] @@ -36,7 +37,7 @@ public void MultipleKeyMultipleItemsCallsEachOnce() { void AssertBreak(string expected, params Tuple[] input) { result = string.Empty; new Break(Start, Item, End).Process(input); - Assert.AreEqual(expected, result); + ClassicAssert.AreEqual(expected, result); } void Item(string key, string value) { diff --git a/source/fitSharpTest/NUnit/Machine/CreateDefaultTest.cs b/source/fitSharpTest/NUnit/Machine/CreateDefaultTest.cs index 285c55fe..c1ca3a05 100644 --- a/source/fitSharpTest/NUnit/Machine/CreateDefaultTest.cs +++ b/source/fitSharpTest/NUnit/Machine/CreateDefaultTest.cs @@ -7,6 +7,7 @@ using fitSharp.Machine.Model; using fitSharp.Test.Double; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] public class CreateDefaultTest { @@ -18,12 +19,12 @@ [SetUp] public void SetUp() { [Test] public void InstanceIsCreated() { TypedValue result = runtime.Create(new IdentifierName(typeof(SampleClass).FullName), new TreeList()); - Assert.IsTrue(result.Value is SampleClass); + ClassicAssert.IsTrue(result.Value is SampleClass); } [Test] public void StandardInstanceIsCreated() { TypedValue result = runtime.Create(new IdentifierName("System.Boolean"), new TreeList()); - Assert.IsTrue(result.Value is bool); + ClassicAssert.IsTrue(result.Value is bool); } } } diff --git a/source/fitSharpTest/NUnit/Machine/CultureTest.cs b/source/fitSharpTest/NUnit/Machine/CultureTest.cs index 655056ae..981edeb3 100644 --- a/source/fitSharpTest/NUnit/Machine/CultureTest.cs +++ b/source/fitSharpTest/NUnit/Machine/CultureTest.cs @@ -7,26 +7,27 @@ using System.Threading; using fitSharp.Machine.Engine; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] [SetCulture("en-US")] public class CultureTest { [Test] public void SetUpSetsCulture() { var culture = new Culture {Name = "af-ZA"}; culture.SetUp(); - Assert.AreEqual("af-ZA", Thread.CurrentThread.CurrentCulture.Name); + ClassicAssert.AreEqual("af-ZA", Thread.CurrentThread.CurrentCulture.Name); } [Test] public void TearDownRestoresCulture() { var culture = new Culture {Name = "af-ZA"}; culture.SetUp(); culture.TearDown(); - Assert.AreEqual("en-US", Thread.CurrentThread.CurrentCulture.Name); + ClassicAssert.AreEqual("en-US", Thread.CurrentThread.CurrentCulture.Name); } [Test] public void InvariantCultureIsSet() { var culture = new Culture {Name = "invariant"}; culture.SetUp(); - Assert.AreEqual(CultureInfo.InvariantCulture, Thread.CurrentThread.CurrentCulture); + ClassicAssert.AreEqual(CultureInfo.InvariantCulture, Thread.CurrentThread.CurrentCulture); } } } diff --git a/source/fitSharpTest/NUnit/Machine/DefaultParseTest.cs b/source/fitSharpTest/NUnit/Machine/DefaultParseTest.cs index 280e105d..a33412b4 100644 --- a/source/fitSharpTest/NUnit/Machine/DefaultParseTest.cs +++ b/source/fitSharpTest/NUnit/Machine/DefaultParseTest.cs @@ -8,6 +8,7 @@ using fitSharp.Machine.Model; using fitSharp.Test.Double; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] public class DefaultParseTest { @@ -20,28 +21,28 @@ [SetUp] public void SetUp() { [Test] public void StringIsParsed() { TypedValue result = parse.Parse(typeof (string), TypedValue.Void, new TreeList("stuff")); - Assert.AreEqual("stuff", result.Value); + ClassicAssert.AreEqual("stuff", result.Value); } [Test] public void DateIsParsed() { TypedValue result = parse.Parse(typeof(DateTime), TypedValue.Void, new TreeList("03 Jan 2008")); - Assert.AreEqual(new DateTime(2008, 1, 3), result.Value); + ClassicAssert.AreEqual(new DateTime(2008, 1, 3), result.Value); } [Test] public void ClassIsParsed() { TypedValue result = parse.Parse(typeof(SampleClass), TypedValue.Void, new TreeList("stuff")); - Assert.IsTrue(result.Value is SampleClass); + ClassicAssert.IsTrue(result.Value is SampleClass); } [Test] public void ClassWithStringConstructorIsParsed() { TypedValue result = parse.Parse(typeof(ClassFromString), TypedValue.Void, new TreeList("stuff")); - Assert.IsTrue(result.Value is ClassFromString); + ClassicAssert.IsTrue(result.Value is ClassFromString); } [Test] public void StructWithParseAndConstructorIsParsed() { TypedValue result = parse.Parse(typeof(StructWithParseAndConstructor), TypedValue.Void, new TreeList("stuff")); - Assert.IsTrue(result.Value is StructWithParseAndConstructor); - Assert.AreEqual("stuffparsector", result.GetValue().stuff); + ClassicAssert.IsTrue(result.Value is StructWithParseAndConstructor); + ClassicAssert.AreEqual("stuffparsector", result.GetValue().stuff); } private class ClassFromString { diff --git a/source/fitSharpTest/NUnit/Machine/IdentifierNameTest.cs b/source/fitSharpTest/NUnit/Machine/IdentifierNameTest.cs index 0034aa5c..f4ed559a 100644 --- a/source/fitSharpTest/NUnit/Machine/IdentifierNameTest.cs +++ b/source/fitSharpTest/NUnit/Machine/IdentifierNameTest.cs @@ -5,35 +5,36 @@ using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] public class IdentifierNameTest { [Test] public void MatchesString() { - Assert.IsTrue(new IdentifierName("stuff").Matches("stuff")); + ClassicAssert.IsTrue(new IdentifierName("stuff").Matches("stuff")); } [Test] public void MatchIgnoresCase() { - Assert.IsTrue(new IdentifierName("stUFf").Matches("Stuff")); + ClassicAssert.IsTrue(new IdentifierName("stUFf").Matches("Stuff")); } [Test] public void WhitespaceIsTrimmed() { - Assert.IsTrue(new IdentifierName(" stuff\n").Matches("stuff")); + ClassicAssert.IsTrue(new IdentifierName(" stuff\n").Matches("stuff")); } [Test] public void UnderscoreInMatchIsIgnored() { - Assert.IsTrue(new IdentifierName("stuff").Matches("stu_ff")); + ClassicAssert.IsTrue(new IdentifierName("stuff").Matches("stu_ff")); } [Test] public void UnderscoreInNameIsIgnored() { - Assert.IsTrue(new IdentifierName("stu_ff").Matches("stu_ff")); + ClassicAssert.IsTrue(new IdentifierName("stu_ff").Matches("stu_ff")); } [Test] public void NoInputIsEmpty() { - Assert.IsTrue(new IdentifierName(" \n").IsEmpty); + ClassicAssert.IsTrue(new IdentifierName(" \n").IsEmpty); } [Test] public void StartsString() { - Assert.IsTrue(new IdentifierName("hi").IsStartOf("Hi Mom!")); + ClassicAssert.IsTrue(new IdentifierName("hi").IsStartOf("Hi Mom!")); } } } \ No newline at end of file diff --git a/source/fitSharpTest/NUnit/Machine/InvokeDefaultTest.cs b/source/fitSharpTest/NUnit/Machine/InvokeDefaultTest.cs index 779ec078..8605a4b3 100644 --- a/source/fitSharpTest/NUnit/Machine/InvokeDefaultTest.cs +++ b/source/fitSharpTest/NUnit/Machine/InvokeDefaultTest.cs @@ -9,6 +9,7 @@ using fitSharp.Samples.Fit; using fitSharp.Test.Double; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] public class InvokeDefaultTest { @@ -41,14 +42,14 @@ public void MethodIsInvokedViaDomainAdapter() { [Test] public void MethodIsInvokedWithParameterName() { var result = processor.Invoke(new TypedValue(new SampleClass()), new MemberName("methodwithparms").WithNamedParameters(), new CellTree("input", "stuff")); - Assert.AreEqual(typeof (string), result.Type); - Assert.AreEqual("samplestuff", result.Value); + ClassicAssert.AreEqual(typeof (string), result.Type); + ClassicAssert.AreEqual("samplestuff", result.Value); } void CheckInvokeMethod(object instance, string methodName, string input, string resultValue) { var result = processor.Invoke(new TypedValue(instance), new MemberName(methodName), new CellTree(input)); - Assert.AreEqual(typeof (string), result.Type); - Assert.AreEqual(resultValue, result.Value); + ClassicAssert.AreEqual(typeof (string), result.Type); + ClassicAssert.AreEqual(resultValue, result.Value); } class SampleDomainAdapter: DomainAdapter { diff --git a/source/fitSharpTest/NUnit/Machine/LoggingTest.cs b/source/fitSharpTest/NUnit/Machine/LoggingTest.cs index db3f9b95..ce923e04 100644 --- a/source/fitSharpTest/NUnit/Machine/LoggingTest.cs +++ b/source/fitSharpTest/NUnit/Machine/LoggingTest.cs @@ -6,6 +6,7 @@ using fitSharp.Machine.Engine; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] public class LoggingTest { @@ -17,20 +18,20 @@ [SetUp] public void SetUp() { [Test] public void LoggingIsDisabledWhenCreated() { logging.WriteItem("stuff"); - Assert.AreEqual(string.Empty, logging.Show); + ClassicAssert.AreEqual(string.Empty, logging.Show); } [Test] public void LoggingIsStarted() { logging.Start(); logging.WriteItem("stuff"); - Assert.AreEqual("
  • stuff
", logging.Show); + ClassicAssert.AreEqual("
  • stuff
", logging.Show); } [Test] public void MultipleMessagesAreLogged() { logging.Start(); logging.WriteItem("stuff"); logging.WriteItem("nonsense"); - Assert.AreEqual("
  • stuff
  • nonsense
", logging.Show); + ClassicAssert.AreEqual("
  • stuff
  • nonsense
", logging.Show); } [Test] public void LoggingIsStopped() { @@ -38,7 +39,7 @@ [Test] public void LoggingIsStopped() { logging.WriteItem("stuff"); logging.Stop(); logging.WriteItem("stuff"); - Assert.AreEqual("
  • stuff
", logging.Show); + ClassicAssert.AreEqual("
  • stuff
", logging.Show); } [Test] public void SubMessageIsLogged() { @@ -46,7 +47,7 @@ [Test] public void SubMessageIsLogged() { logging.StartWrite("stuff"); logging.WriteItem("sub"); logging.EndWrite("nonsense"); - Assert.AreEqual("
  • stuffnonsense
    • sub
", logging.Show); + ClassicAssert.AreEqual("
  • stuffnonsense
    • sub
", logging.Show); } [Test] public void SubMessageIsNotLoggedWhenStopped() { @@ -55,38 +56,38 @@ [Test] public void SubMessageIsNotLoggedWhenStopped() { logging.WriteItem("sub"); logging.Stop(); logging.EndWrite("nonsense"); - Assert.AreEqual("
  • sub
", logging.Show); + ClassicAssert.AreEqual("
  • sub
", logging.Show); } [Test] public void LoggerCanRegisterWhenAdded() { logging.Add(new TestLogger()); - Assert.IsTrue(TestLogger.IsRegistered); + ClassicAssert.IsTrue(TestLogger.IsRegistered); } [Test] public void LoggerReceivesStartEvent() { logging.Add(new TestLogger()); logging.Start(); - Assert.IsTrue(TestLogger.IsStarted); + ClassicAssert.IsTrue(TestLogger.IsStarted); } [Test] public void LoggerReceivesStopEvent() { logging.Add(new TestLogger()); logging.Start(); logging.Stop(); - Assert.IsFalse(TestLogger.IsStarted); + ClassicAssert.IsFalse(TestLogger.IsStarted); } [Test] public void LoggerDoesNotReceiveEventsWhenStopped() { logging.Add(new TestLogger()); logging.BeginCell(new CellBase("stuff")); - Assert.AreEqual(null, TestLogger.ActiveCell); + ClassicAssert.AreEqual(null, TestLogger.ActiveCell); } [Test] public void LoggerReceivesBeginCellEvent() { logging.Add(new TestLogger()); logging.Start(); logging.BeginCell(new CellBase("stuff")); - Assert.AreEqual("stuff", TestLogger.ActiveCell.Text); + ClassicAssert.AreEqual("stuff", TestLogger.ActiveCell.Text); } [Test] public void LoggerReceivesEndCellEvent() { @@ -95,7 +96,7 @@ [Test] public void LoggerReceivesEndCellEvent() { var cell = new CellBase("stuff"); logging.BeginCell(cell); logging.EndCell(cell); - Assert.AreEqual(null, TestLogger.ActiveCell); + ClassicAssert.AreEqual(null, TestLogger.ActiveCell); } class TestLogger: Logger { diff --git a/source/fitSharpTest/NUnit/Machine/MemberNameBuilderTest.cs b/source/fitSharpTest/NUnit/Machine/MemberNameBuilderTest.cs index a23956cd..c8c879e1 100644 --- a/source/fitSharpTest/NUnit/Machine/MemberNameBuilderTest.cs +++ b/source/fitSharpTest/NUnit/Machine/MemberNameBuilderTest.cs @@ -6,6 +6,7 @@ using fitSharp.Machine.Engine; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] @@ -14,41 +15,41 @@ public class MemberNameBuilderTest { [Test] public void ParsesGenericTypeWithBlanks() { // old behaviour, preserve for compatibility var member = Parse("generic of some class"); - Assert.AreEqual("genericofsomeclass", member.Name); - Assert.True(member.Matches(typeof(BuilderSample).GetMethod("Generic"))); + ClassicAssert.AreEqual("genericofsomeclass", member.Name); + ClassicAssert.True(member.Matches(typeof(BuilderSample).GetMethod("Generic"))); } [Test] public void ParsesGenericType() { var member = Parse("generic.of.some class"); var methodInfo = typeof(BuilderSample).GetMethod("Generic"); - Assert.True(member.Matches(methodInfo)); + ClassicAssert.True(member.Matches(methodInfo)); var genericMember = member.MakeMember(methodInfo, new BuilderSample()); - Assert.AreEqual("SomeClass", genericMember.Invoke(new object [] {}).Value); + ClassicAssert.AreEqual("SomeClass", genericMember.Invoke(new object [] {}).Value); } [Test] public void ParsesMultipleGenericTypes() { var member = Parse("multi generic.of.some class.of.some other class"); var methodInfo = typeof(BuilderSample).GetMethod("MultiGeneric"); - Assert.True(member.Matches(methodInfo)); + ClassicAssert.True(member.Matches(methodInfo)); var genericMember = member.MakeMember(methodInfo, new BuilderSample()); - Assert.AreEqual("SomeClassSomeOtherClass", genericMember.Invoke(new object [] {}).Value); + ClassicAssert.AreEqual("SomeClassSomeOtherClass", genericMember.Invoke(new object [] {}).Value); } [Test] public void ParsesExtensionMethod() { var member = Parse("extension.in.some extensions"); - Assert.True(member.Matches(typeof(SomeExtensions).GetMethod("Extension"))); + ClassicAssert.True(member.Matches(typeof(SomeExtensions).GetMethod("Extension"))); } [Test] public void ParsesMethodWithEmbeddedOf() { var member = Parse("not of generic"); - Assert.True(member.Matches(typeof(BuilderSample).GetMethod("NotOfGeneric"))); + ClassicAssert.True(member.Matches(typeof(BuilderSample).GetMethod("NotOfGeneric"))); } [Test] public void ParsesGenericExtensionMethod() { - Assert.True(Parse("generic.of.some class.in.some extensions") + ClassicAssert.True(Parse("generic.of.some class.in.some extensions") .Matches(typeof(SomeExtensions).GetMethod("Generic"))); } diff --git a/source/fitSharpTest/NUnit/Machine/MemberQueryTest.cs b/source/fitSharpTest/NUnit/Machine/MemberQueryTest.cs index 85bff520..c359f79e 100644 --- a/source/fitSharpTest/NUnit/Machine/MemberQueryTest.cs +++ b/source/fitSharpTest/NUnit/Machine/MemberQueryTest.cs @@ -10,6 +10,7 @@ using fitSharp.Samples.Fit; using fitSharp.Test.Double; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] public class MemberQueryTest { @@ -21,9 +22,9 @@ [SetUp] public void SetUp() { [Test] public void VoidMethodIsInvoked() { var result = Invoke(GetMethod("countmethod", 0)); - Assert.AreEqual(null, result.Value); - Assert.AreEqual(typeof(void), result.Type); - Assert.AreEqual(1, instance.Count); + ClassicAssert.AreEqual(null, result.Value); + ClassicAssert.AreEqual(typeof(void), result.Type); + ClassicAssert.AreEqual(1, instance.Count); } Maybe GetMethod(string memberName, int count) { @@ -36,15 +37,15 @@ TypedValue Invoke(Maybe method) { } TypedValue Invoke(Maybe method, object[] parameters) { - Assert.True(method.IsPresent); + ClassicAssert.True(method.IsPresent); return method.Select(m => m.Invoke(parameters)).OrElse(TypedValue.MakeInvalid(new NullReferenceException("method not present"))); } [Test] public void MethodIsInvokedViaProcessor() { var result = Invoke(GetMethodFromProcessor(instance, "countmethod", 0)); - Assert.AreEqual(null, result.Value); - Assert.AreEqual(typeof(void), result.Type); - Assert.AreEqual(1, instance.Count); + ClassicAssert.AreEqual(null, result.Value); + ClassicAssert.AreEqual(typeof(void), result.Type); + ClassicAssert.AreEqual(1, instance.Count); } static Maybe GetMethodFromProcessor(object targetInstance, string memberName, int parameterCount) { @@ -55,18 +56,18 @@ static Maybe GetMethodFromProcessor(object targetInstance, string [Test] public void MethodWithReturnIsInvoked() { var result = Invoke(GetMethod("methodnoparms", 0)); - Assert.AreEqual("samplereturn", result.Value.ToString()); - Assert.AreEqual(typeof(string), result.Type); + ClassicAssert.AreEqual("samplereturn", result.Value.ToString()); + ClassicAssert.AreEqual(typeof(string), result.Type); } [Test] public void MethodWithUnderscoresIsInvoked() { var result = Invoke(GetMethod("methodwithunderscores", 0)); - Assert.AreEqual("samplereturn", result.Value.ToString()); + ClassicAssert.AreEqual("samplereturn", result.Value.ToString()); } [Test] public void MethodWithParmsIsInvoked() { var result = Invoke(GetMethod("methodwithparms", 1), new object[] {"input"}); - Assert.AreEqual("sampleinput", result.Value.ToString()); + ClassicAssert.AreEqual("sampleinput", result.Value.ToString()); } [Test] public void GenericMethodWithParmsIsInvoked() { @@ -74,63 +75,63 @@ [Test] public void GenericMethodWithParmsIsInvoked() { var method = MemberQuery.FindInstance(MemberQuery.FindMember, TypedValue.Of(instance), new MemberSpecification(member, 1)); var result = Invoke(method, new object[] {123}); - Assert.AreEqual("sample123", result.Value.ToString()); + ClassicAssert.AreEqual("sample123", result.Value.ToString()); } [Test] public void StaticMethodWithParmsIsInvoked() { foreach (var method in new RuntimeType(instance.GetType()).FindStatic(MemberName.ParseMethod, new [] {typeof(string)}).Value) { var result = method.Invoke(new object[] {"input"}); - Assert.AreEqual(typeof (SampleClass), result.Type); + ClassicAssert.AreEqual(typeof (SampleClass), result.Type); return; } - Assert.Fail("no method"); + ClassicAssert.Fail("no method"); } [Test] public void ConstructorIsInvoked() { var method = new RuntimeType(instance.GetType()).GetConstructor(0); - Assert.IsNotNull(method); + ClassicAssert.IsNotNull(method); var result = method.Invoke(new object[] {}); - Assert.AreEqual(typeof(SampleClass), result.Type); + ClassicAssert.AreEqual(typeof(SampleClass), result.Type); } [Test] public void PropertySetAndGetIsInvoked() { var result = Invoke(GetMethod("property", 1), new object[] {"stuff"}); - Assert.AreEqual(null, result.Value); - Assert.AreEqual(typeof(void), result.Type); + ClassicAssert.AreEqual(null, result.Value); + ClassicAssert.AreEqual(typeof(void), result.Type); result = Invoke(GetMethod("property", 0)); - Assert.AreEqual("stuff", result.Value.ToString()); - Assert.AreEqual(typeof(string), result.Type); + ClassicAssert.AreEqual("stuff", result.Value.ToString()); + ClassicAssert.AreEqual(typeof(string), result.Type); } [Test] public void IndexerIsInvoked() { var result = Invoke(GetMethod("anything", 0)); - Assert.AreEqual("indexanything", result.Value); - Assert.AreEqual(typeof(string), result.Type); + ClassicAssert.AreEqual("indexanything", result.Value); + ClassicAssert.AreEqual(typeof(string), result.Type); } [Test] public void FieldIsInvokedWithGetAndSet() { var result = Invoke(GetMethod("setfield", 1), new object[] {"stuff"}); - Assert.AreEqual(null, result.Value); - Assert.AreEqual(typeof(void), result.Type); + ClassicAssert.AreEqual(null, result.Value); + ClassicAssert.AreEqual(typeof(void), result.Type); result = Invoke(GetMethod("getfield", 0)); - Assert.AreEqual("stuff", result.Value.ToString()); - Assert.AreEqual(typeof(string), result.Type); + ClassicAssert.AreEqual("stuff", result.Value.ToString()); + ClassicAssert.AreEqual(typeof(string), result.Type); } [Test] public void DuplicateIsInvoked() { Invoke(GetMethod("duplicate", 1), new object[] {"stuff"}); var result = Invoke(GetMethod("duplicate", 0)); - Assert.AreEqual("stuff", result.ToString()); + ClassicAssert.AreEqual("stuff", result.ToString()); } [Test] public void QueryableMemberIsInvoked() { var queryable = new QueryableClass(); var method = GetMethodFromProcessor(queryable, "dynamic", 1); var result = Invoke(method, new object[] {"stuff"}); - Assert.AreEqual("dynamicstuff", result.Value); + ClassicAssert.AreEqual("dynamicstuff", result.Value); } [Test] @@ -138,12 +139,12 @@ public void ExtensionMethodIsInvoked() { var name = new MemberName("increase(sampleextension)", "increase", Maybe.Of(typeof(SampleExtension)), Array.Empty()); var method = MemberQuery.FindInstance(MemberQuery.FindMember, TypedValue.Of(instance), new MemberSpecification(name, 1)); var result = Invoke(method, new object[] {2}); - Assert.AreEqual(2, result.Value); + ClassicAssert.AreEqual(2, result.Value); } class QueryableClass: MemberQueryable { public RuntimeMember Find(MemberSpecification specification) { - Assert.IsTrue(specification.MatchesIdentifierName("dynamic")); + ClassicAssert.IsTrue(specification.MatchesIdentifierName("dynamic")); return new QueryableMember("dynamic"); } @@ -175,12 +176,12 @@ public string GetParameterName(int index) { } [Test] public void MethodwithMisMatchedParameterNamesIsNotFound() { - Assert.False(MemberQuery.FindInstance(MemberQuery.FindMember, TypedValue.Of(instance), + ClassicAssert.False(MemberQuery.FindInstance(MemberQuery.FindMember, TypedValue.Of(instance), new MemberSpecification("methodwithparms", 1).WithParameterNames(new [] {"garbage"})).IsPresent); } [Test] public void MethodwithMatchedParameterNamesIsFound() { - Assert.True(MemberQuery.FindInstance(MemberQuery.FindMember, TypedValue.Of(instance), + ClassicAssert.True(MemberQuery.FindInstance(MemberQuery.FindMember, TypedValue.Of(instance), new MemberSpecification("methodwithparms", 1).WithParameterNames(new [] {"input"})).IsPresent); } } diff --git a/source/fitSharpTest/NUnit/Machine/OperatorsTest.cs b/source/fitSharpTest/NUnit/Machine/OperatorsTest.cs index ac6a0502..a78ad4f9 100644 --- a/source/fitSharpTest/NUnit/Machine/OperatorsTest.cs +++ b/source/fitSharpTest/NUnit/Machine/OperatorsTest.cs @@ -6,6 +6,7 @@ using fitSharp.Machine.Engine; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] public class OperatorsTest { @@ -14,7 +15,7 @@ [Test] public void FindsDefaultOperator() { var operators = new Operators>(); var added = operators.Add(typeof(SampleDefaultCreate).FullName); var result = operators.FindOperator>(new object[] {new IdentifierName("test"), null}); - Assert.AreSame(added, result); + ClassicAssert.AreSame(added, result); } [Test] @@ -22,7 +23,7 @@ public void ReplacesOperator() { var operators = new Operators>(); operators.Replace(nameof (CreateDefault>), typeof(SampleDefaultCreate).FullName); var result = operators.FindOperator>(new object[] {new IdentifierName("test"), null}); - Assert.AreEqual(typeof(SampleDefaultCreate), result.GetType()); + ClassicAssert.AreEqual(typeof(SampleDefaultCreate), result.GetType()); } } diff --git a/source/fitSharpTest/NUnit/Machine/ProcessorTest.cs b/source/fitSharpTest/NUnit/Machine/ProcessorTest.cs index 2cfeaba1..ddcdb7de 100644 --- a/source/fitSharpTest/NUnit/Machine/ProcessorTest.cs +++ b/source/fitSharpTest/NUnit/Machine/ProcessorTest.cs @@ -8,6 +8,7 @@ using fitSharp.Machine.Model; using fitSharp.Test.Double; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] public class ProcessorTest { @@ -25,7 +26,7 @@ [SetUp] public void SetUp() { [Test] public void DefaultOperatorIsFound() { processor.AddOperator(defaultTest); object result = Execute(); - Assert.AreEqual("defaultexecute", result.ToString()); + ClassicAssert.AreEqual("defaultexecute", result.ToString()); } private object Execute() { @@ -37,7 +38,7 @@ [Test] public void SpecificOperatorIsFound() { processor.AddOperator(specificTestA); processor.AddOperator(specificTestB); object result = Execute("A"); - Assert.AreEqual("executeA", result.ToString()); + ClassicAssert.AreEqual("executeA", result.ToString()); } private object Execute(string parameter) { @@ -46,26 +47,26 @@ private object Execute(string parameter) { [Test] public void TypeIsCreated() { TypedValue result = processor.Create(typeof(SampleClass).FullName, new TreeList()); - Assert.IsTrue(result.Value is SampleClass); + ClassicAssert.IsTrue(result.Value is SampleClass); } [Test] public void MethodIsInvoked() { var instance = new TypedValue(new SampleClass()); TypedValue result = processor.Invoke(instance, new MemberName("methodnoparms"), new TreeList()); - Assert.AreEqual("samplereturn", result.Value); + ClassicAssert.AreEqual("samplereturn", result.Value); } [Test] public void MethodWithParameterIsInvoked() { var instance = new TypedValue(new SampleClass()); TypedValue result = processor.Invoke(instance, new MemberName("MethodWithParms"), new TreeList().AddBranchValue("stringparm0")); - Assert.AreEqual("samplestringparm0", result.Value); + ClassicAssert.AreEqual("samplestringparm0", result.Value); } [Test] public void ExceptionReturnedAsValue() { var instance = new TypedValue(new SampleClass()); TypedValue result = processor.Invoke(instance, new MemberName("throw"), new TreeList().AddBranchValue("oh no")); - Assert.IsTrue(!result.IsValid); - Assert.IsTrue(result.Value is ApplicationException); + ClassicAssert.IsTrue(!result.IsValid); + ClassicAssert.IsTrue(result.Value is ApplicationException); } [Test] public void ExceptionIsThrown() { @@ -75,31 +76,31 @@ [Test] public void ExceptionIsThrown() { } catch (Exception e) { var exceptionString = e.ToString(); - Assert.IsTrue(exceptionString.Contains("System.ApplicationException")); - Assert.IsTrue(exceptionString.Contains(typeof(SampleClass).FullName ?? string.Empty)); + ClassicAssert.IsTrue(exceptionString.Contains("System.ApplicationException")); + ClassicAssert.IsTrue(exceptionString.Contains(typeof(SampleClass).FullName ?? string.Empty)); return; } - Assert.Fail("no exception"); + ClassicAssert.Fail("no exception"); } [Test] public void OperatorIsRemoved() { processor.AddOperator(defaultTest); processor.AddOperator(specificTestA); object result = Execute("A"); - Assert.AreEqual("executeA", result.ToString()); + ClassicAssert.AreEqual("executeA", result.ToString()); processor.RemoveOperator(specificTestA.GetType().FullName); result = Execute("A"); - Assert.AreEqual("defaultexecute", result.ToString()); + ClassicAssert.AreEqual("defaultexecute", result.ToString()); } [Test] public void EmptyMemoryContainsNothing() { - Assert.IsFalse(processor.Configuration.GetItem().HasValue("anything")); + ClassicAssert.IsFalse(processor.Configuration.GetItem().HasValue("anything")); } [Test] public void StoredDataIsLoaded() { processor.Configuration.GetItem().Save("something", "stuff"); - Assert.IsTrue(processor.Configuration.GetItem().HasValue("something")); - Assert.AreEqual("stuff", processor.Configuration.GetItem().GetValue("something")); + ClassicAssert.IsTrue(processor.Configuration.GetItem().HasValue("something")); + ClassicAssert.AreEqual("stuff", processor.Configuration.GetItem().GetValue("something")); } private class DefaultTest: Operator, InvokeOperator { diff --git a/source/fitSharpTest/NUnit/Machine/ShellArgumentsTest.cs b/source/fitSharpTest/NUnit/Machine/ShellArgumentsTest.cs index e1a317d8..d4c9a9db 100644 --- a/source/fitSharpTest/NUnit/Machine/ShellArgumentsTest.cs +++ b/source/fitSharpTest/NUnit/Machine/ShellArgumentsTest.cs @@ -10,6 +10,7 @@ using fitSharp.Machine.Model; using fitSharp.Samples; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] @@ -31,7 +32,7 @@ public void ChecksForMissingAppConfigFile() { static int AssertAppConfigSpecified(Memory memory) { memory.GetItem().ApplicationBase = "."; - Assert.IsTrue(memory.GetItem().ConfigurationFile.EndsWith("myConfig.xml")); + ClassicAssert.IsTrue(memory.GetItem().ConfigurationFile.EndsWith("myConfig.xml")); return 0; } #endif @@ -68,21 +69,21 @@ void Parse(Func process, Action report, params string[] comm } static int AssertRunnerSpecified(Memory memory) { - Assert.AreEqual("myRunner", memory.GetItem().Runner); + ClassicAssert.AreEqual("myRunner", memory.GetItem().Runner); return 0; } static int AssertNoAction(Memory memory) { - Assert.Fail(); + ClassicAssert.Fail(); return 0; } - static void AssertNothingReported(Error error) { Assert.Fail(error.Message); } + static void AssertNothingReported(Error error) { ClassicAssert.Fail(error.Message); } static void AssertRunnerReported(Error error) { AssertReportContains(error, "runner"); } static void AssertSuiteConfigReported(Error error) { AssertReportContains(error, "Suite configuration file"); } static void AssertReportContains(Error error, string expected) { - Assert.IsTrue(error.Message.Contains(expected), error.Message); + ClassicAssert.IsTrue(error.Message.Contains(expected), error.Message); } [SetUp] diff --git a/source/fitSharpTest/NUnit/Machine/ShellTest.cs b/source/fitSharpTest/NUnit/Machine/ShellTest.cs index 7a005b42..420823b9 100644 --- a/source/fitSharpTest/NUnit/Machine/ShellTest.cs +++ b/source/fitSharpTest/NUnit/Machine/ShellTest.cs @@ -16,6 +16,7 @@ using fitSharp.Machine.Model; using fitSharp.Samples; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] public class ShellTest { @@ -24,7 +25,7 @@ [TestFixture] public class ShellTest { [Test] public void CustomAppConfigIsUsed() { var result = RunShell(new[] {"-a", "fitSharpTest.dll.alt.config", "-r", typeof (SampleRunner).FullName + "," + typeof (SampleRunner).Assembly.CodeBase} ); - Assert.AreEqual(606, result); + ClassicAssert.AreEqual(606, result); } [Test] public void CustomAppConfigIsLoadedRelativeToExecutingAssembly() { @@ -39,7 +40,7 @@ [Test] public void CustomAppConfigFromSuiteConfigIsUsed() { folders.MakeFile(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "fitSharpTest.dll.alt.config"), "stuff"); var result = RunShell(new[] {"-c", "suite.config.xml", "-r", typeof (SampleRunner).FullName + "," + typeof (SampleRunner).Assembly.CodeBase}, folders ); - Assert.AreEqual(606, result); + ClassicAssert.AreEqual(606, result); } class PushCurrentDirectory : IDisposable { @@ -58,14 +59,14 @@ public void Dispose() { [Test] public void RunnerIsCalled() { var result = RunShell(new [] {"-r", typeof(SampleRunner).FullName}); - Assert.AreEqual(SampleRunner.Result, result); + ClassicAssert.AreEqual(SampleRunner.Result, result); } [Test] public void AdditionalArgumentsArePassed() { RunShell(new [] {"more", "-r", typeof(SampleRunner).FullName, "stuff"}); - Assert.AreEqual(2, SampleRunner.LastArguments.Count); - Assert.AreEqual("more", SampleRunner.LastArguments[0]); - Assert.AreEqual("stuff", SampleRunner.LastArguments[1]); + ClassicAssert.AreEqual(2, SampleRunner.LastArguments.Count); + ClassicAssert.AreEqual("more", SampleRunner.LastArguments[0]); + ClassicAssert.AreEqual("stuff", SampleRunner.LastArguments[1]); } [Test] public void RunnerFromSuiteConfigIsUsed() { @@ -75,7 +76,7 @@ [Test] public void RunnerFromSuiteConfigIsUsed() { + TargetFramework.Location(typeof (SampleRunner).Assembly) + ""); var result = RunShell(new[] {"-c", "suite.config.xml"}, folders ); - Assert.AreEqual(SampleRunner.Result, result); + ClassicAssert.AreEqual(SampleRunner.Result, result); } [Test] public void ApartmentStateFromSuiteConfigIsUsed() { @@ -83,7 +84,7 @@ [Test] public void ApartmentStateFromSuiteConfigIsUsed() { var folders = new FolderTestModel(); folders.MakeFile("suite.config.xml", "STA"); RunShell(new[] {"-r", typeof(SampleRunner).FullName, "-c", "suite.config.xml"}, folders ); - Assert.AreEqual(ApartmentState.STA, SampleRunner.ApartmentState); + ClassicAssert.AreEqual(ApartmentState.STA, SampleRunner.ApartmentState); } static int RunShell(IList arguments) { diff --git a/source/fitSharpTest/NUnit/Machine/StringDifferenceTest.cs b/source/fitSharpTest/NUnit/Machine/StringDifferenceTest.cs index a9c6d273..104fe183 100644 --- a/source/fitSharpTest/NUnit/Machine/StringDifferenceTest.cs +++ b/source/fitSharpTest/NUnit/Machine/StringDifferenceTest.cs @@ -5,23 +5,24 @@ using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] public class StringDifferenceTest { [Test] public void FirstCharacterDifferent() { - Assert.AreEqual("At 0 expected A was B", new StringDifference("A", "B").ToString()); + ClassicAssert.AreEqual("At 0 expected A was B", new StringDifference("A", "B").ToString()); } [Test] public void SecondCharacterDifferent() { - Assert.AreEqual("At 1 expected A was B", new StringDifference("aA", "aB").ToString()); + ClassicAssert.AreEqual("At 1 expected A was B", new StringDifference("aA", "aB").ToString()); } [Test] public void LengthDifferent() { - Assert.AreEqual("Length expected 2 was 1", new StringDifference("aA", "a").ToString()); + ClassicAssert.AreEqual("Length expected 2 was 1", new StringDifference("aA", "a").ToString()); } [Test] public void UnviewableCharactersShownAsHex() { - Assert.AreEqual("At 1 expected x20 was xfffe", new StringDifference("a ", "a\xFFFE").ToString()); + ClassicAssert.AreEqual("At 1 expected x20 was xfffe", new StringDifference("a ", "a\xFFFE").ToString()); } } } diff --git a/source/fitSharpTest/NUnit/Machine/StringTest.cs b/source/fitSharpTest/NUnit/Machine/StringTest.cs index 6112e25b..25cb27c4 100644 --- a/source/fitSharpTest/NUnit/Machine/StringTest.cs +++ b/source/fitSharpTest/NUnit/Machine/StringTest.cs @@ -5,19 +5,20 @@ using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] public class StringTest { [Test] - public void FindsTextBeforeValue() { Assert.AreEqual("some", "somebeforestuff".Before("before")); } + public void FindsTextBeforeValue() { ClassicAssert.AreEqual("some", "somebeforestuff".Before("before")); } [Test] - public void FindsTextBeforeMultipleValues() { Assert.AreEqual("some", "somebeforestuff".Before(new [] {"befox", "before"})); } + public void FindsTextBeforeMultipleValues() { ClassicAssert.AreEqual("some", "somebeforestuff".Before(new [] {"befox", "before"})); } [Test] - public void FindsShortestTextBeforeMultipleValues() { Assert.AreEqual("some", "somebeforebefoxstuff".Before(new [] {"befox", "before"})); } + public void FindsShortestTextBeforeMultipleValues() { ClassicAssert.AreEqual("some", "somebeforebefoxstuff".Before(new [] {"befox", "before"})); } } } \ No newline at end of file diff --git a/source/fitSharpTest/NUnit/Machine/SuiteConfigurationTest.cs b/source/fitSharpTest/NUnit/Machine/SuiteConfigurationTest.cs index 8ac60bee..25e7102e 100644 --- a/source/fitSharpTest/NUnit/Machine/SuiteConfigurationTest.cs +++ b/source/fitSharpTest/NUnit/Machine/SuiteConfigurationTest.cs @@ -8,6 +8,7 @@ using fitSharp.Machine.Model; using fitSharp.Test.Double; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] public class SuiteConfigurationTest { @@ -17,28 +18,28 @@ [SetUp] public void SetUp() { } [Test] public void MethodIsExecuted() { suiteConfiguration.LoadXml("stuff"); - Assert.AreEqual("stuff", memory.GetItem().Data); + ClassicAssert.AreEqual("stuff", memory.GetItem().Data); } [Test] public void MethodWithTwoParametersIsExecuted() { suiteConfiguration.LoadXml("stuff"); - Assert.AreEqual("more stuff", memory.GetItem().Data); + ClassicAssert.AreEqual("more stuff", memory.GetItem().Data); } [Test] public void TwoFilesAreLoadedIncrementally() { suiteConfiguration.LoadXml("stuff"); suiteConfiguration.LoadXml("more"); - Assert.AreEqual("stuffmore", memory.GetItem().Data); + ClassicAssert.AreEqual("stuffmore", memory.GetItem().Data); } [Test] public void AliasTypeIsUsed() { suiteConfiguration.LoadXml("stuff"); - Assert.AreEqual("stuff", memory.GetItem().InputFolder); + ClassicAssert.AreEqual("stuff", memory.GetItem().InputFolder); } [Test] public void AliasMethodIsUsed() { suiteConfiguration.LoadXml("fitSharp.Test.NUnit.Machine"); - Assert.IsNotNull(memory.GetItem().FindType(new IdentifierName("SuiteConfigurationTest"))); + ClassicAssert.IsNotNull(memory.GetItem().FindType(new IdentifierName("SuiteConfigurationTest"))); } Memory memory; diff --git a/source/fitSharpTest/NUnit/Machine/TraverseTest.cs b/source/fitSharpTest/NUnit/Machine/TraverseTest.cs index 23a05e99..65216453 100644 --- a/source/fitSharpTest/NUnit/Machine/TraverseTest.cs +++ b/source/fitSharpTest/NUnit/Machine/TraverseTest.cs @@ -7,6 +7,7 @@ using fitSharp.Machine.Model; using NUnit.Framework; using System.Collections.Generic; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] public class TraverseTest { @@ -18,28 +19,28 @@ [Test] public void VisitsFirstRow() { new Traverse() .Rows.First(Visit) .VisitTable(new CellTree("fixture", "row1", "row2")); - Assert.AreEqual("fixture", nodesVisited.Join(",")); + ClassicAssert.AreEqual("fixture", nodesVisited.Join(",")); } [Test] public void VisitsHeaderRow() { new Traverse() .Rows.Header(Visit) .VisitTable(new CellTree("fixture", "row1", "row2")); - Assert.AreEqual("row1", nodesVisited.Join(",")); + ClassicAssert.AreEqual("row1", nodesVisited.Join(",")); } [Test] public void VisitsRestOfRows() { new Traverse() .Rows.Rest(Visit) .VisitTable(new CellTree("fixture", "row1", "row2")); - Assert.AreEqual("row2", nodesVisited.Join(",")); + ClassicAssert.AreEqual("row2", nodesVisited.Join(",")); } [Test] public void VisitsAllRows() { new Traverse() .Rows.Rest(Visit) .VisitTable(new CellTree("fixture", "row1", "row2")); - Assert.AreEqual("row2", nodesVisited.Join(",")); + ClassicAssert.AreEqual("row2", nodesVisited.Join(",")); } void Visit(Tree tree) { nodesVisited.Add(tree.Value.Text); } diff --git a/source/fitSharpTest/NUnit/Machine/TreeTest.cs b/source/fitSharpTest/NUnit/Machine/TreeTest.cs index bd35f0cb..e833eb69 100644 --- a/source/fitSharpTest/NUnit/Machine/TreeTest.cs +++ b/source/fitSharpTest/NUnit/Machine/TreeTest.cs @@ -6,19 +6,20 @@ using System.Text; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] public class TreeTest { [Test] public void LeafHasOneLeaf() { var result = new StringBuilder(); foreach (string leaf in new TreeList("a").Leaves()) result.Append(leaf); - Assert.AreEqual("a", result.ToString()); + ClassicAssert.AreEqual("a", result.ToString()); } [Test] public void EmptyTreeHasNoLeaves() { var result = new StringBuilder(); foreach (string leaf in new TreeList().Leaves()) result.Append(leaf); - Assert.AreEqual(string.Empty, result.ToString()); + ClassicAssert.AreEqual(string.Empty, result.ToString()); } [Test] public void LeafyTreeHasManyLeaves() { @@ -30,7 +31,7 @@ [Test] public void LeafyTreeHasManyLeaves() { .AddBranchValue("c")) .AddBranchValue("d"); foreach (string leaf in tree.Leaves()) result.Append(leaf); - Assert.AreEqual("abcd", result.ToString()); + ClassicAssert.AreEqual("abcd", result.ToString()); } } } \ No newline at end of file diff --git a/source/fitSharpTest/NUnit/Machine/TypeDictionaryTest.cs b/source/fitSharpTest/NUnit/Machine/TypeDictionaryTest.cs index c5563838..76e1dcf7 100644 --- a/source/fitSharpTest/NUnit/Machine/TypeDictionaryTest.cs +++ b/source/fitSharpTest/NUnit/Machine/TypeDictionaryTest.cs @@ -7,6 +7,7 @@ using fitSharp.Machine.Model; using fitSharp.Test.Double; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Machine { [TestFixture] public class TypeDictionaryTest { @@ -21,25 +22,25 @@ [Test] public void CopyableChangesDontShowInCopy() { configuration.GetItem().Data = "stuff"; var copy = configuration.Copy(); configuration.GetItem().Data = "other"; - Assert.AreEqual("stuff", copy.GetItem().Data); - Assert.AreEqual("other", configuration.GetItem().Data); + ClassicAssert.AreEqual("stuff", copy.GetItem().Data); + ClassicAssert.AreEqual("other", configuration.GetItem().Data); } [Test] public void OtherChangesShowInCopy() { configuration.GetItem().Data = "stuff"; var copy = configuration.Copy(); configuration.GetItem().Data = "other"; - Assert.AreEqual("other", copy.GetItem().Data); - Assert.AreEqual("other", configuration.GetItem().Data); + ClassicAssert.AreEqual("other", copy.GetItem().Data); + ClassicAssert.AreEqual("other", configuration.GetItem().Data); } [Test] public void SetUpTearDownIsExecuted() { configuration.GetItem().Data = "stuff"; configuration.Apply(i => i.As(s => s.SetUp())); - Assert.AreEqual("setup", configuration.GetItem().Data); + ClassicAssert.AreEqual("setup", configuration.GetItem().Data); configuration.Apply(i => i.As(s => s.TearDown())); - Assert.AreEqual("teardown", configuration.GetItem().Data); + ClassicAssert.AreEqual("teardown", configuration.GetItem().Data); } } diff --git a/source/fitSharpTest/NUnit/Parser/ExcelCellTest.cs b/source/fitSharpTest/NUnit/Parser/ExcelCellTest.cs index d4f544c5..52620a6e 100644 --- a/source/fitSharpTest/NUnit/Parser/ExcelCellTest.cs +++ b/source/fitSharpTest/NUnit/Parser/ExcelCellTest.cs @@ -5,6 +5,7 @@ using fitSharp.Parser; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Parser { [TestFixture] @@ -15,8 +16,8 @@ public class ExcelCellTest { [TestCase("ABC123", 730, 122)] public void TranslatesAddress(string address, int expectedColumn, int expectedRow) { var cell = new ExcelCell(address, ""); - Assert.AreEqual(expectedColumn, cell.Column); - Assert.AreEqual(expectedRow, cell.Row); + ClassicAssert.AreEqual(expectedColumn, cell.Column); + ClassicAssert.AreEqual(expectedRow, cell.Row); } } } diff --git a/source/fitSharpTest/NUnit/Parser/ExcelSheetTest.cs b/source/fitSharpTest/NUnit/Parser/ExcelSheetTest.cs index 0d6f4353..c8d362f8 100644 --- a/source/fitSharpTest/NUnit/Parser/ExcelSheetTest.cs +++ b/source/fitSharpTest/NUnit/Parser/ExcelSheetTest.cs @@ -8,6 +8,7 @@ using NUnit.Framework; using System.Linq; using System.Xml.Linq; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Parser { [TestFixture] @@ -55,7 +56,7 @@ static void AssertParses(string worksheet, string expected, string strings = " new TreeList(new CellBase(text))); sheet.LoadStrings(XDocument.Parse(strings)); var sheetDocument = XDocument.Parse(worksheet); - Assert.AreEqual(expected, sheet.Parse(sheetDocument).Format()); + ClassicAssert.AreEqual(expected, sheet.Parse(sheetDocument).Format()); } static string Worksheet(params string[] addresses) { diff --git a/source/fitSharpTest/NUnit/Parser/HtmlTablesTest.cs b/source/fitSharpTest/NUnit/Parser/HtmlTablesTest.cs index 9e7951de..c382690e 100644 --- a/source/fitSharpTest/NUnit/Parser/HtmlTablesTest.cs +++ b/source/fitSharpTest/NUnit/Parser/HtmlTablesTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2018 Syterra Software Inc. All rights reserved. +// Copyright � 2018 Syterra Software Inc. All rights reserved. // The use and distribution terms for this software are covered by the Common Public License 1.0 (http://opensource.org/licenses/cpl.php) // which can be found in the file license.txt at the root of this distribution. By using this software in any fashion, you are agreeing // to be bound by the terms of this license. You must not remove this notice, or any other, from this software. @@ -8,28 +8,29 @@ using fitSharp.Machine.Model; using fitSharp.Parser; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Parser { [TestFixture] public class HtmlTablesTest { [Test] public void ParseEmpty() { var result = Parse(string.Empty); - Assert.IsTrue(result.Branches.Count == 0); + ClassicAssert.IsTrue(result.Branches.Count == 0); } [Test] public void ParseNoTables() { var result = Parse("set the table"); - Assert.IsTrue(result.Branches.Count == 0); + ClassicAssert.IsTrue(result.Branches.Count == 0); result = Parse("set the (() => Parse("leader
trailer")); + ClassicAssert.Throws(() => Parse("leader
trailer")); } [Test] public void ParseTableWithBody() { - Assert.Throws(() =>Parse("leaderbody
trailer")); + ClassicAssert.Throws(() =>Parse("leaderbody
trailer")); } [Test] public void ParseTwoTables() { @@ -38,7 +39,7 @@ [Test] public void ParseTwoTables() { } [Test] public void ParseRow() { - Assert.Throws(() =>Parse(" leader
")); + ClassicAssert.Throws(() =>Parse(" leader
")); } [Test] public void ParseCell() { @@ -130,7 +131,7 @@ public void ParseCommentSeveralCommentBlocks() { } static void AssertParse(string input, string expected) { - Assert.AreEqual("
" + expected + "
", Parse(input).Format()); + ClassicAssert.AreEqual("
" + expected + "
", Parse(input).Format()); } static Tree Parse(string input) { diff --git a/source/fitSharpTest/NUnit/Parser/ScannerTest.cs b/source/fitSharpTest/NUnit/Parser/ScannerTest.cs index 5f7db0ed..dd5be290 100644 --- a/source/fitSharpTest/NUnit/Parser/ScannerTest.cs +++ b/source/fitSharpTest/NUnit/Parser/ScannerTest.cs @@ -5,6 +5,7 @@ using fitSharp.Parser; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Parser { [TestFixture] @@ -15,7 +16,7 @@ public void FindsDelimitedText() { Scan("basic [text] to be scanned"); AssertLeader("basic "); AssertBody("text"); - Assert.AreEqual("[text]", scanner.Element.ToString()); + ClassicAssert.AreEqual("[text]", scanner.Element.ToString()); } [Test] @@ -88,11 +89,11 @@ void AssertEmpty(string input) { } void AssertBody(string expected) { - Assert.AreEqual(expected, scanner.Body.ToString()); + ClassicAssert.AreEqual(expected, scanner.Body.ToString()); } void AssertLeader(string expected) { - Assert.AreEqual(expected, scanner.Leader.ToString()); + ClassicAssert.AreEqual(expected, scanner.Leader.ToString()); } void Scan(string input) { diff --git a/source/fitSharpTest/NUnit/Parser/TextTableScannerTest.cs b/source/fitSharpTest/NUnit/Parser/TextTableScannerTest.cs index 1dc24726..be0256af 100644 --- a/source/fitSharpTest/NUnit/Parser/TextTableScannerTest.cs +++ b/source/fitSharpTest/NUnit/Parser/TextTableScannerTest.cs @@ -6,6 +6,7 @@ using System.Text; using fitSharp.Parser; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Parser { [TestFixture] public class TextTableScannerTest { @@ -21,7 +22,7 @@ static void AssertRawScan(string input, string expected) { result.AppendFormat("{0}", token.Type); if (token.Content.Length > 0) result.AppendFormat("={0}", token.Content); } - Assert.AreEqual(expected, result.ToString()); + ClassicAssert.AreEqual(expected, result.ToString()); } [Test] public void ScansPrefixAsLeader() { diff --git a/source/fitSharpTest/NUnit/Parser/TextTablesTest.cs b/source/fitSharpTest/NUnit/Parser/TextTablesTest.cs index 5433c946..e19bfdde 100644 --- a/source/fitSharpTest/NUnit/Parser/TextTablesTest.cs +++ b/source/fitSharpTest/NUnit/Parser/TextTablesTest.cs @@ -7,11 +7,12 @@ using fitSharp.Machine.Model; using fitSharp.Parser; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Parser { [TestFixture] public class TextTablesTest { [Test] public void ParsesEmptyInputAsEmptyTree() { - Assert.AreEqual(0, Parse(string.Empty).Branches.Count); + ClassicAssert.AreEqual(0, Parse(string.Empty).Branches.Count); } [Test] public void ParsesWordAsCell() { @@ -88,13 +89,13 @@ [Test] public void IncludesLeaderInSecondTable() { } static void AssertParse(string input, string expected) { - Assert.AreEqual( + ClassicAssert.AreEqual( " test@" + expected, Parse(input).Format()); } static void AssertParseRaw(string input, string expected) { - Assert.AreEqual( + ClassicAssert.AreEqual( expected, ParseRaw(input).Format()); } diff --git a/source/fitSharpTest/NUnit/Slim/AnalyzerTest.cs b/source/fitSharpTest/NUnit/Slim/AnalyzerTest.cs index 8e077c0f..44652470 100644 --- a/source/fitSharpTest/NUnit/Slim/AnalyzerTest.cs +++ b/source/fitSharpTest/NUnit/Slim/AnalyzerTest.cs @@ -7,6 +7,7 @@ using fitSharp.Slim.Analysis; using fitSharp.Slim.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Slim { [TestFixture] @@ -83,7 +84,7 @@ public void SetUp() { } void AssertCalls(string expected) { - Assert.AreEqual(expected, string.Join(",", analyzer.Calls)); + ClassicAssert.AreEqual(expected, string.Join(",", analyzer.Calls)); } void Process(params object[] items) { diff --git a/source/fitSharpTest/NUnit/Slim/ComposeOperatorsTest.cs b/source/fitSharpTest/NUnit/Slim/ComposeOperatorsTest.cs index 58798c65..23923606 100644 --- a/source/fitSharpTest/NUnit/Slim/ComposeOperatorsTest.cs +++ b/source/fitSharpTest/NUnit/Slim/ComposeOperatorsTest.cs @@ -14,6 +14,7 @@ using fitSharp.Slim.Service; using fitSharp.Test.Double.Slim; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Slim { [TestFixture] public class ComposeOperatorsTest { @@ -51,30 +52,30 @@ [Test] public void BooleanFalseIsComposed() { [Test] [SetCulture("en-US")] public void ListIsComposedAsTree() { processor.AddOperator(new ComposeDefault()); var result = Compose(new ComposeList(), new List {"a", 1.23}, typeof (List)); - Assert.IsNotNull(result); - Assert.AreEqual(2, result.Branches.Count); - Assert.AreEqual("a", result.ValueAt(0)); - Assert.AreEqual("1.23", result.ValueAt(1)); + ClassicAssert.IsNotNull(result); + ClassicAssert.AreEqual(2, result.Branches.Count); + ClassicAssert.AreEqual("a", result.ValueAt(0)); + ClassicAssert.AreEqual("1.23", result.ValueAt(1)); } [Test] [SetCulture("en-US")] public void ArrayIsComposedAsTree() { processor.AddOperator(new ComposeDefault()); var result = Compose(new ComposeList(), new object[] {"a", 1.23}, typeof (List)); - Assert.IsNotNull(result); - Assert.AreEqual(2, result.Branches.Count); - Assert.AreEqual("a", result.ValueAt(0)); - Assert.AreEqual("1.23", result.ValueAt(1)); + ClassicAssert.IsNotNull(result); + ClassicAssert.AreEqual(2, result.Branches.Count); + ClassicAssert.AreEqual("a", result.ValueAt(0)); + ClassicAssert.AreEqual("1.23", result.ValueAt(1)); } [Test] public void NestedListIsComposedAsTree() { processor.AddOperator(new ComposeDefault()); processor.AddOperator(new ComposeList()); var result = Compose(new ComposeList(), new List {"a", new List {"b", "c"}}, typeof (List)); - Assert.IsNotNull(result); - Assert.AreEqual(2, result.Branches.Count); - Assert.AreEqual("a", result.ValueAt(0)); - Assert.AreEqual("b", result.ValueAt(1, 0)); - Assert.AreEqual("c", result.ValueAt(1, 1)); + ClassicAssert.IsNotNull(result); + ClassicAssert.AreEqual(2, result.Branches.Count); + ClassicAssert.AreEqual("a", result.ValueAt(0)); + ClassicAssert.AreEqual("b", result.ValueAt(1, 0)); + ClassicAssert.AreEqual("c", result.ValueAt(1, 1)); } [Test] public void ExceptionIsComposed() { @@ -113,7 +114,7 @@ [Test] public void StopSuiteExceptionIsComposed() { Tree Compose(ComposeOperator composeOperator, object instance, Type type) { var compose = (SlimOperator)composeOperator; compose.Processor = processor; - Assert.IsTrue(composeOperator.CanCompose(new TypedValue(instance, type))); + ClassicAssert.IsTrue(composeOperator.CanCompose(new TypedValue(instance, type))); return composeOperator.Compose(new TypedValue(instance, type)); } @@ -124,9 +125,9 @@ void CheckExceptionCompose(Exception exception, string expected) { void CheckCompose(ComposeOperator composeOperator, object instance, Type type, object expected) { var compose = (SlimOperator)composeOperator; compose.Processor = processor; - Assert.IsTrue(composeOperator.CanCompose(new TypedValue(instance, type))); + ClassicAssert.IsTrue(composeOperator.CanCompose(new TypedValue(instance, type))); Tree result = composeOperator.Compose(new TypedValue(instance, type)); - Assert.AreEqual(expected, result.Value); + ClassicAssert.AreEqual(expected, result.Value); } class MyStopTestException: Exception {} diff --git a/source/fitSharpTest/NUnit/Slim/ConverterTest.cs b/source/fitSharpTest/NUnit/Slim/ConverterTest.cs index 71e25807..4ac9612e 100644 --- a/source/fitSharpTest/NUnit/Slim/ConverterTest.cs +++ b/source/fitSharpTest/NUnit/Slim/ConverterTest.cs @@ -8,6 +8,7 @@ using fitSharp.Slim.Service; using fitSharp.Test.Double.Slim; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Slim { [TestFixture] public class ConverterTest { @@ -15,20 +16,20 @@ [TestFixture] public class ConverterTest { [Test] public void CustomTypeIsParsed() { var converter = new CustomConverter {Processor = processor}; - Assert.IsTrue(converter.CanParse(typeof(CustomClass), TypedValue.Void, new TreeList("info"))); + ClassicAssert.IsTrue(converter.CanParse(typeof(CustomClass), TypedValue.Void, new TreeList("info"))); TypedValue parseResult = converter.Parse(typeof(CustomClass), TypedValue.Void, new TreeList("info")); var result = parseResult.Value as CustomClass; - Assert.IsNotNull(result); - Assert.AreEqual("custominfo", result.Info); + ClassicAssert.IsNotNull(result); + ClassicAssert.AreEqual("custominfo", result.Info); } [Test] public void CustomTypeIsComposed() { var converter = new CustomConverter(); - Assert.IsTrue(converter.CanCompose(new TypedValue(new CustomClass {Info = "stuff"}))); + ClassicAssert.IsTrue(converter.CanCompose(new TypedValue(new CustomClass {Info = "stuff"}))); Tree composeResult = converter.Compose(new TypedValue(new CustomClass {Info = "stuff"})); var result = composeResult.Value; - Assert.IsNotNull(result); - Assert.AreEqual("mystuff", result); + ClassicAssert.IsNotNull(result); + ClassicAssert.AreEqual("mystuff", result); } class CustomConverter: Converter { diff --git a/source/fitSharpTest/NUnit/Slim/DocumentTest.cs b/source/fitSharpTest/NUnit/Slim/DocumentTest.cs index 189c4129..93281ee7 100644 --- a/source/fitSharpTest/NUnit/Slim/DocumentTest.cs +++ b/source/fitSharpTest/NUnit/Slim/DocumentTest.cs @@ -7,19 +7,20 @@ using fitSharp.Slim.Model; using fitSharp.Slim.Service; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Slim { [TestFixture] public class DocumentTest { [Test] public void ParsesBracketsAsList() { fitSharp.Slim.Service.Document document = ParseAsList("[000002:000004:some:000005:stuff]", 2); - Assert.AreEqual("some",document.Content.ValueAt(0)); - Assert.AreEqual("stuff",document.Content.ValueAt(1)); + ClassicAssert.AreEqual("some",document.Content.ValueAt(0)); + ClassicAssert.AreEqual("stuff",document.Content.ValueAt(1)); } static fitSharp.Slim.Service.Document ParseAsList(string input, int expectedCount) { fitSharp.Slim.Service.Document document = fitSharp.Slim.Service.Document.Parse(input); - Assert.AreEqual(expectedCount, document.Content.Branches.Count); + ClassicAssert.AreEqual(expectedCount, document.Content.Branches.Count); return document; } @@ -33,8 +34,8 @@ [Test] public void ParsesBracketsWithoutCountAsString() { static void ParsesAsString(string input) { fitSharp.Slim.Service.Document document = fitSharp.Slim.Service.Document.Parse(input); - Assert.IsTrue(document.Content.IsLeaf); - Assert.AreEqual(input,document.Content.Value); + ClassicAssert.IsTrue(document.Content.IsLeaf); + ClassicAssert.AreEqual(input,document.Content.Value); } [Test] public void ParsesBracketsWithShortCountAsString() { @@ -42,14 +43,14 @@ [Test] public void ParsesBracketsWithShortCountAsString() { } [Test] public void ComposesList() { - Assert.AreEqual(new Document(new SlimTree().AddBranches("hello", "world")).ToString(), + ClassicAssert.AreEqual(new Document(new SlimTree().AddBranches("hello", "world")).ToString(), "[000002:000005:hello:000005:world:]"); } [Test] public void ComposesNestedList() { - Assert.AreEqual(new Document(new SlimTree().AddBranch(new SlimTree().AddBranches("hello", "world"))).ToString(), + ClassicAssert.AreEqual(new Document(new SlimTree().AddBranch(new SlimTree().AddBranches("hello", "world"))).ToString(), "[000001:000035:[000002:000005:hello:000005:world:]:]"); - Assert.AreEqual(new Document(new SlimTree().AddBranch(new SlimLeaf("[000002:000005:hello:000005:world:]"))).ToString(), + ClassicAssert.AreEqual(new Document(new SlimTree().AddBranch(new SlimLeaf("[000002:000005:hello:000005:world:]"))).ToString(), "[000001:000035:[000002:000005:hello:000005:world:]:]"); } } diff --git a/source/fitSharpTest/NUnit/Slim/ExecuteOperatorsTest.cs b/source/fitSharpTest/NUnit/Slim/ExecuteOperatorsTest.cs index 1bf99cf9..d3fe3799 100644 --- a/source/fitSharpTest/NUnit/Slim/ExecuteOperatorsTest.cs +++ b/source/fitSharpTest/NUnit/Slim/ExecuteOperatorsTest.cs @@ -10,6 +10,7 @@ using fitSharp.Slim.Service; using fitSharp.Test.Double.Slim; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Slim { [TestFixture] public class ExecuteOperatorsTest { @@ -38,7 +39,7 @@ [Test] public void ExecuteMakeUsesSymbolInClassName() { var executeMake = new ExecuteMake { Processor = processor }; var input = new SlimTree().AddBranchValue("step").AddBranchValue("make").AddBranchValue("variable").AddBranchValue("fitSharp.Test.$symbol.Slim.SampleClass"); ExecuteOperation(executeMake, input, 2); - Assert.IsTrue(processor.Get().GetValue("variable") is SampleClass); + ClassicAssert.IsTrue(processor.Get().GetValue("variable") is SampleClass); } [Test] public void ExecuteMakeUsesSymbolAsFullClassName() { @@ -46,7 +47,7 @@ [Test] public void ExecuteMakeUsesSymbolAsFullClassName() { var executeMake = new ExecuteMake { Processor = processor }; var input = new SlimTree().AddBranchValue("step").AddBranchValue("make").AddBranchValue("variable").AddBranchValue("$symbol"); ExecuteOperation(executeMake, input, 2); - Assert.IsTrue(processor.Get().GetValue("variable") is SampleClass); + ClassicAssert.IsTrue(processor.Get().GetValue("variable") is SampleClass); } [Test] public void ExecuteMakeUsesSymbolAsObject() { @@ -55,7 +56,7 @@ [Test] public void ExecuteMakeUsesSymbolAsObject() { var executeMake = new ExecuteMake { Processor = processor }; var input = new SlimTree().AddBranchValue("step").AddBranchValue("make").AddBranchValue("variable").AddBranchValue("$symbol"); ExecuteOperation(executeMake, input, 2); - Assert.AreEqual(newClass, processor.Get().GetValue("variable")); + ClassicAssert.AreEqual(newClass, processor.Get().GetValue("variable")); } [Test] public void ExecuteMakeLibraryIsStacked() { @@ -63,10 +64,10 @@ [Test] public void ExecuteMakeLibraryIsStacked() { var input = new SlimTree().AddBranchValue("step").AddBranchValue("make").AddBranchValue("librarystuff").AddBranchValue("fitSharp.Test.NUnit.Slim.SampleClass"); ExecuteOperation(executeMake, input, 2); foreach (var libraryInstance in processor.LibraryInstances) { - Assert.IsTrue(libraryInstance.Value is SampleClass); + ClassicAssert.IsTrue(libraryInstance.Value is SampleClass); return; } - Assert.Fail(); + ClassicAssert.Fail(); } [Test] public void ExecuteCallBadMethodReturnsException() { @@ -82,14 +83,14 @@ [Test] public void ExecuteCallUsesExtensionMethod() { var executeCall = new ExecuteCall { Processor = processor }; var input = new SlimTree().AddBranchValue("step").AddBranchValue("call").AddBranchValue("variable").AddBranchValue("increase.in.sampleextension").AddBranchValue("2"); ExecuteOperation(executeCall, input, 2); - Assert.AreEqual("3", result.ValueAt(1)); + ClassicAssert.AreEqual("3", result.ValueAt(1)); } [Test] public void ExecuteImportAddsNamespace() { var executeImport = new ExecuteImport { Processor = processor }; var input = new SlimTree().AddBranchValue("step").AddBranchValue("import").AddBranchValue("fitSharp.Test.NUnit.Slim"); ExecuteOperation(executeImport, input, 2); - Assert.IsTrue(processor.Create("SampleClass", new SlimTree()).Value is SampleClass); + ClassicAssert.IsTrue(processor.Create("SampleClass", new SlimTree()).Value is SampleClass); } [Test] public void ExecuteCallAndAssignSavesSymbol() { @@ -99,8 +100,8 @@ [Test] public void ExecuteCallAndAssignSavesSymbol() { new SlimTree().AddBranchValue("step").AddBranchValue("callAndAssign").AddBranchValue("symbol").AddBranchValue( "variable").AddBranchValue("sampleMethod"); ExecuteOperation(executeCallAndAssign, input, 2); - Assert.AreEqual("testresult", result.ValueAt(1)); - Assert.AreEqual("testresult", processor.Get().GetValue("symbol")); + ClassicAssert.AreEqual("testresult", result.ValueAt(1)); + ClassicAssert.AreEqual("testresult", processor.Get().GetValue("symbol")); } [Test] public void ExecuteCallUsesDomainAdapter() { @@ -108,7 +109,7 @@ [Test] public void ExecuteCallUsesDomainAdapter() { var executeCall = new ExecuteCall { Processor = processor }; var input = new SlimTree().AddBranchValue("step").AddBranchValue("call").AddBranchValue("variable").AddBranchValue("DomainMethod"); ExecuteOperation(executeCall, input, 2); - Assert.AreEqual("domainstuff", result.ValueAt(1)); + ClassicAssert.AreEqual("domainstuff", result.ValueAt(1)); } [Test] public void ExecuteCallOnMissingInstanceUsesLibrary() { @@ -119,13 +120,13 @@ [Test] public void ExecuteCallOnMissingInstanceUsesLibrary() { input = new SlimTree().AddBranchValue("step").AddBranchValue("call").AddBranchValue("garbage").AddBranchValue("SampleMethod"); SampleClass.MethodCount = 0; ExecuteOperation(executeCall, input, 2); - Assert.AreEqual(1, SampleClass.MethodCount); + ClassicAssert.AreEqual(1, SampleClass.MethodCount); } [Test] public void ExecuteGetFixtureReturnsActorInstance() { MakeSampleClass("sampleData"); CallActorMethod("getFixture"); - Assert.AreEqual("Sample=sampleData", result.ValueAt(1)); + ClassicAssert.AreEqual("Sample=sampleData", result.ValueAt(1)); } [Test] public void ExecutePushAndPopFixtureReturnsActorInstance() { @@ -134,7 +135,7 @@ [Test] public void ExecutePushAndPopFixtureReturnsActorInstance() { MakeSampleClass("otherData"); CallActorMethod("popFixture"); CallActorMethod("info"); - Assert.AreEqual("sampleData", result.ValueAt(1)); + ClassicAssert.AreEqual("sampleData", result.ValueAt(1)); } [Test] @@ -145,8 +146,8 @@ public void ExecuteAssignSavesSymol() { new SlimTree().AddBranchValue("step").AddBranchValue("assign").AddBranchValue("symbol").AddBranchValue( "value"); ExecuteOperation(executeAssign, input, 2); - Assert.AreEqual("OK", result.ValueAt(1)); - Assert.AreEqual("value", processor.Get().GetValue("symbol")); + ClassicAssert.AreEqual("OK", result.ValueAt(1)); + ClassicAssert.AreEqual("value", processor.Get().GetValue("symbol")); } void MakeSampleClass(string sampleData) { @@ -167,13 +168,13 @@ void ExecuteOperation(InvokeOperator executeOperator, Tree input executeResult = executeOperator.Invoke(new TypedValue(new SlimInstruction()), new MemberName(string.Empty), input); } result = executeResult.GetValue>(); - Assert.IsFalse(result.IsLeaf); - Assert.AreEqual(branchCount, result.Branches.Count); - Assert.AreEqual("step", result.ValueAt(0)); + ClassicAssert.IsFalse(result.IsLeaf); + ClassicAssert.AreEqual(branchCount, result.Branches.Count); + ClassicAssert.AreEqual("step", result.ValueAt(0)); } void CheckForException(string exceptionText) { - Assert.IsTrue(result.ValueAt(1).StartsWith("__EXCEPTION__:" + exceptionText)); + ClassicAssert.IsTrue(result.ValueAt(1).StartsWith("__EXCEPTION__:" + exceptionText)); } Service processor; diff --git a/source/fitSharpTest/NUnit/Slim/InterpreterTest.cs b/source/fitSharpTest/NUnit/Slim/InterpreterTest.cs index 425b0944..278ebfa0 100644 --- a/source/fitSharpTest/NUnit/Slim/InterpreterTest.cs +++ b/source/fitSharpTest/NUnit/Slim/InterpreterTest.cs @@ -8,6 +8,7 @@ using fitSharp.Slim.Service; using fitSharp.Test.Double.Slim; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Slim { [TestFixture] public class InterpreterTest { @@ -25,7 +26,7 @@ [Test] public void MultipleStepsAreExecuted() { .ExecuteMethod("samplemethod"); SampleClass.MethodCount = 0; Execute(instructions.InstructionString); - Assert.AreEqual(2, SampleClass.MethodCount); + ClassicAssert.AreEqual(2, SampleClass.MethodCount); } [Test] public void StopTestExceptionSkipsRemainingSteps() { @@ -36,7 +37,7 @@ [Test] public void StopTestExceptionSkipsRemainingSteps() { .ExecuteMethod("samplemethod"); SampleClass.MethodCount = 0; Execute(instructions.InstructionString); - Assert.AreEqual(1, SampleClass.MethodCount); + ClassicAssert.AreEqual(1, SampleClass.MethodCount); } [Test] public void StopSuiteExceptionSkipsRemainingSteps() { @@ -47,11 +48,11 @@ [Test] public void StopSuiteExceptionSkipsRemainingSteps() { .ExecuteMethod("samplemethod"); SampleClass.MethodCount = 0; Execute(instructions.InstructionString); - Assert.AreEqual(1, SampleClass.MethodCount); + ClassicAssert.AreEqual(1, SampleClass.MethodCount); } [Test] public void EmptyInstructionReturnEmptyList() { - Assert.AreEqual("Slim -- V0.5\n000009:[000000:]", Execute("[000000:]")); + ClassicAssert.AreEqual("Slim -- V0.5\n000009:[000000:]", Execute("[000000:]")); } [Test] public void ExecutesMethodOnLibraryInstance() { @@ -61,7 +62,7 @@ [Test] public void ExecutesMethodOnLibraryInstance() { .ExecuteMethod("samplemethod"); SampleClass.MethodCount = 0; Execute(instructions.InstructionString); - Assert.AreEqual(1, SampleClass.MethodCount); + ClassicAssert.AreEqual(1, SampleClass.MethodCount); } string Execute(string instructionString) { diff --git a/source/fitSharpTest/NUnit/Slim/InvokeLibraryTest.cs b/source/fitSharpTest/NUnit/Slim/InvokeLibraryTest.cs index a94bc232..c14c99cf 100644 --- a/source/fitSharpTest/NUnit/Slim/InvokeLibraryTest.cs +++ b/source/fitSharpTest/NUnit/Slim/InvokeLibraryTest.cs @@ -8,6 +8,7 @@ using fitSharp.Slim.Operators; using fitSharp.Test.Double.Slim; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Slim { [TestFixture] public class InvokeLibraryTest { @@ -17,7 +18,7 @@ [Test] public void SearchesLibraryInstancesForMethod() { var runtime = new InvokeLibrary { Processor = processor }; SampleClass.MethodCount = 0; runtime.Invoke(new TypedValue("stuff"), new MemberName("samplemethod"), new TreeList()); - Assert.AreEqual(1, SampleClass.MethodCount); + ClassicAssert.AreEqual(1, SampleClass.MethodCount); } } } diff --git a/source/fitSharpTest/NUnit/Slim/MessengerTest.cs b/source/fitSharpTest/NUnit/Slim/MessengerTest.cs index 66e71e0e..e1c5ab58 100644 --- a/source/fitSharpTest/NUnit/Slim/MessengerTest.cs +++ b/source/fitSharpTest/NUnit/Slim/MessengerTest.cs @@ -7,6 +7,7 @@ using fitSharp.Samples; using fitSharp.Slim.Service; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Slim { @@ -15,28 +16,28 @@ public class MessengerTest { [Test] public void WritesVersion() { - Assert.AreEqual("Slim -- V0.5\n", port.Output); + ClassicAssert.AreEqual("Slim -- V0.5\n", port.Output); } [Test] public void WritesMessageWithLengthPrefix() { port.Clear(); messenger.Write("hello"); - Assert.AreEqual("000005:hello", port.Output); + ClassicAssert.AreEqual("000005:hello", port.Output); } [Test] public void ReadsMessageWithLengthPrefix() { port.AddInput("000005:hello"); - Assert.AreEqual("hello", messenger.Read()); + ClassicAssert.AreEqual("hello", messenger.Read()); } [Test] public void AtEndWhenByeRead() { port.AddInput("000003:bye"); messenger.Read(); - Assert.IsTrue(messenger.IsEnd); - Assert.IsFalse(port.IsOpen); + ClassicAssert.IsTrue(messenger.IsEnd); + ClassicAssert.IsFalse(port.IsOpen); } /* slow tests @@ -44,13 +45,13 @@ public void AtEndWhenByeRead() { public void WritesLongMessageWithLengthPrefix() { session.Output = string.Empty; messenger.Write(new string('a', 1000000)); - Assert.IsTrue(session.Output.StartsWith("1000000:a")); + ClassicAssert.IsTrue(session.Output.StartsWith("1000000:a")); } [Test] public void ReadsLongMessageWithLengthPrefix() { session.Input = "1000000:" + new string('a', 1000000); - Assert.AreEqual(1000000, messenger.Read().Length); + ClassicAssert.AreEqual(1000000, messenger.Read().Length); }*/ [SetUp] diff --git a/source/fitSharpTest/NUnit/Slim/ParseOperatorsTest.cs b/source/fitSharpTest/NUnit/Slim/ParseOperatorsTest.cs index 34e237af..b804690c 100644 --- a/source/fitSharpTest/NUnit/Slim/ParseOperatorsTest.cs +++ b/source/fitSharpTest/NUnit/Slim/ParseOperatorsTest.cs @@ -13,6 +13,7 @@ using fitSharp.Slim.Service; using fitSharp.Test.Double.Slim; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Slim { @@ -37,99 +38,99 @@ [SetUp] public void SetUp() { public void ParseSymbolReplacesWithValueAsImplementation() { var testvalue = ConcreteObject.NewInstance(); processor.Get().Save("symbol", testvalue); - Assert.AreEqual(testvalue, Parse(new ParseSymbol { Processor = processor }, typeof(ConcreteObject), new SlimLeaf("$symbol"))); + ClassicAssert.AreEqual(testvalue, Parse(new ParseSymbol { Processor = processor }, typeof(ConcreteObject), new SlimLeaf("$symbol"))); } [Test] public void ParseSymbolReplacesWithValueAsInterface() { var testvalue = ConcreteObject.NewInstance(); processor.Get().Save("symbol", testvalue); - Assert.AreEqual(testvalue, Parse(new ParseSymbol { Processor = processor }, typeof(IObject), new SlimLeaf("$symbol"))); + ClassicAssert.AreEqual(testvalue, Parse(new ParseSymbol { Processor = processor }, typeof(IObject), new SlimLeaf("$symbol"))); } [Test] public void ParseSymbolReplacesWithValue() { processor.Get().Save("symbol", "testvalue"); - Assert.AreEqual("testvalue", Parse(new ParseSymbol { Processor = processor }, typeof(object), new SlimLeaf("$symbol"))); + ClassicAssert.AreEqual("testvalue", Parse(new ParseSymbol { Processor = processor }, typeof(object), new SlimLeaf("$symbol"))); } [Test] public void ParseSymbolReplacesEmbeddedValues() { processor.Get().Save("symbol1", "test"); processor.Get().Save("symbol2", "value"); - Assert.AreEqual("-testvalue-", Parse(new ParseSymbol { Processor = processor }, typeof(object), new SlimLeaf("-$symbol1$symbol2-"))); + ClassicAssert.AreEqual("-testvalue-", Parse(new ParseSymbol { Processor = processor }, typeof(object), new SlimLeaf("-$symbol1$symbol2-"))); } [Test] public void ParseSymbolIgnoresUndefinedSymbols() { - Assert.AreEqual("$symbol", processor.Parse(typeof(object), TypedValue.Void, new SlimLeaf("$symbol")).ValueString); + ClassicAssert.AreEqual("$symbol", processor.Parse(typeof(object), TypedValue.Void, new SlimLeaf("$symbol")).ValueString); } [Test] public void ParseSymbolIgnoresEmbeddedUndefinedSymbols() { - Assert.AreEqual("-$symbol-", processor.Parse(typeof(object), TypedValue.Void, new SlimLeaf("-$symbol-")).ValueString); + ClassicAssert.AreEqual("-$symbol-", processor.Parse(typeof(object), TypedValue.Void, new SlimLeaf("-$symbol-")).ValueString); } [Test] public void ParseSymbolWithDoubleDollar() { processor.Get().Save("symbol", "testvalue"); - Assert.AreEqual("$testvalue", processor.Parse(typeof(object), TypedValue.Void, new SlimLeaf("$$symbol")).ValueString); + ClassicAssert.AreEqual("$testvalue", processor.Parse(typeof(object), TypedValue.Void, new SlimLeaf("$$symbol")).ValueString); } [Test] public void ParseSymbolEmbeddedWithDoubleDollar() { processor.Get().Save("symbol", "testvalue"); - Assert.AreEqual("-$testvaluetestvalue-", processor.Parse(typeof(object), TypedValue.Void, new SlimLeaf("-$$symbol$symbol-")).ValueString); + ClassicAssert.AreEqual("-$testvaluetestvalue-", processor.Parse(typeof(object), TypedValue.Void, new SlimLeaf("-$$symbol$symbol-")).ValueString); } [Test] public void ParseSymbolMatchingRequestedType() { processor.Get().Save("symbol", AppDomain.CurrentDomain); - Assert.AreEqual(AppDomain.CurrentDomain, processor.Parse(typeof(AppDomain), TypedValue.Void, new SlimLeaf("$symbol")).Value); + ClassicAssert.AreEqual(AppDomain.CurrentDomain, processor.Parse(typeof(AppDomain), TypedValue.Void, new SlimLeaf("$symbol")).Value); } [Test] public void LeafIsParsedForList() { var list = Parse(new ParseList{ Processor = processor }, typeof (List), new SlimLeaf("[5, 4]")) as List; - Assert.IsNotNull(list); - Assert.AreEqual(2, list.Count); - Assert.AreEqual(5, list[0]); - Assert.AreEqual(4, list[1]); + ClassicAssert.IsNotNull(list); + ClassicAssert.AreEqual(2, list.Count); + ClassicAssert.AreEqual(5, list[0]); + ClassicAssert.AreEqual(4, list[1]); } [Test] public void TreeIsParsedForList() { var list = Parse(new ParseList{ Processor = processor }, typeof (List), new SlimTree().AddBranchValue("5").AddBranchValue("4")) as List; - Assert.IsNotNull(list); - Assert.AreEqual(2, list.Count); - Assert.AreEqual(5, list[0]); - Assert.AreEqual(4, list[1]); + ClassicAssert.IsNotNull(list); + ClassicAssert.AreEqual(2, list.Count); + ClassicAssert.AreEqual(5, list[0]); + ClassicAssert.AreEqual(4, list[1]); } [Test] public void LeafIsParsedForArray() { var list = Parse(new ParseList{ Processor = processor }, typeof (int[]), new SlimLeaf("[5, 4]")) as int[]; - Assert.IsNotNull(list); - Assert.AreEqual(2, list.Length); - Assert.AreEqual(5, list[0]); - Assert.AreEqual(4, list[1]); + ClassicAssert.IsNotNull(list); + ClassicAssert.AreEqual(2, list.Length); + ClassicAssert.AreEqual(5, list[0]); + ClassicAssert.AreEqual(4, list[1]); } [Test] public void ParsesEnumType() { - Assert.AreEqual(BindingFlags.Public, + ClassicAssert.AreEqual(BindingFlags.Public, processor.Parse(typeof (BindingFlags), TypedValue.Void, new SlimLeaf("Public")).Value); } [Test] public void ParsesIntegerForNullableInt() { - Assert.AreEqual(1, processor.Parse(typeof (int?), TypedValue.Void, new SlimLeaf("1")).Value); + ClassicAssert.AreEqual(1, processor.Parse(typeof (int?), TypedValue.Void, new SlimLeaf("1")).Value); } [Test] public void ParsesDictionary() { var dictionary = processor.Parse(typeof (Dictionary), TypedValue.Void, new SlimLeaf("
keyvalue
")).GetValue>(); - Assert.AreEqual("value", dictionary["key"]); + ClassicAssert.AreEqual("value", dictionary["key"]); } [Test] [SetCulture("es-ES")] public void ParsesWithCurrentCulture() { - Assert.AreEqual(1.001, processor.Parse(typeof (double), TypedValue.Void, new SlimLeaf("1,001")).Value); + ClassicAssert.AreEqual(1.001, processor.Parse(typeof (double), TypedValue.Void, new SlimLeaf("1,001")).Value); } static object Parse(ParseOperator parseOperator, Type type, Tree parameters) { - Assert.IsTrue(parseOperator.CanParse(type, TypedValue.Void, parameters)); + ClassicAssert.IsTrue(parseOperator.CanParse(type, TypedValue.Void, parameters)); TypedValue result = parseOperator.Parse(type, TypedValue.Void, parameters); return result.Value; } diff --git a/source/fitSharpTest/NUnit/Slim/ReportTest.cs b/source/fitSharpTest/NUnit/Slim/ReportTest.cs index 4988a890..c667b731 100644 --- a/source/fitSharpTest/NUnit/Slim/ReportTest.cs +++ b/source/fitSharpTest/NUnit/Slim/ReportTest.cs @@ -9,6 +9,7 @@ using fitSharp.Machine.Engine; using fitSharp.Slim.Analysis; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Slim { [TestFixture] @@ -38,7 +39,7 @@ static void AssertReport(string input, string expected) { var applicationUnderTest = new ApplicationUnderTest(); applicationUnderTest.AddNamespace("fitSharp.Test.NUnit.Slim"); Report.RunReport(applicationUnderTest, new StringReader(input), new StringWriter(output)); - Assert.AreEqual(expected, output.ToString()); + ClassicAssert.AreEqual(expected, output.ToString()); } static readonly string pageInstructions1 = "MyPageOne|[000002:000087:[000004:000015:scriptTable_0_0:000004:make:000016:scriptTableActor:000011:SampleClass:]:000088:[000004:000015:scriptTable_0_1:000004:call:000016:scriptTableActor:000012:sampleMethod:]:]" + Environment.NewLine; diff --git a/source/fitSharpTest/NUnit/Slim/ServiceTest.cs b/source/fitSharpTest/NUnit/Slim/ServiceTest.cs index d7c0f3a1..08a074f3 100644 --- a/source/fitSharpTest/NUnit/Slim/ServiceTest.cs +++ b/source/fitSharpTest/NUnit/Slim/ServiceTest.cs @@ -11,6 +11,7 @@ using fitSharp.Slim.Service; using fitSharp.Test.Double.Slim; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Slim { [TestFixture] public class ServiceTest { @@ -24,7 +25,7 @@ [Test] public void InstanceIsCreated() { SampleClass.Count = 0; var statement = new Instructions().MakeVariable("variable", typeof (SampleClass)); DoInstruction(statement); - Assert.AreEqual(1, SampleClass.Count); + ClassicAssert.AreEqual(1, SampleClass.Count); } private TypedValue DoInstruction(Instructions statement) { @@ -37,14 +38,14 @@ [Test] public void OperatorIsAddedFromConfiguration() { var statement = new Instructions().MakeCommand("sampleCommand"); service = new Service(configuration); var result = DoInstruction(statement).GetValue>(); - Assert.AreEqual("sampleResult", result.ValueAt(1)); + ClassicAssert.AreEqual("sampleResult", result.ValueAt(1)); } [Test] public void ParseSymbolIsDoneFirst() { service.Get().Save("symbol", "input"); service.AddOperator(new SampleConverter()); var value = (SampleClass)service.Parse(typeof(SampleClass), TypedValue.Void, new SlimLeaf("$symbol")).Value; - Assert.AreEqual("custominput", value.Info); + ClassicAssert.AreEqual("custominput", value.Info); } [Test] public void CustomComposeIsCalled() { @@ -53,7 +54,7 @@ [Test] public void CustomComposeIsCalled() { DoInstruction(statement); statement = new Instructions().ExecuteMethod("makesample"); var result = DoInstruction(statement).GetValue(); - Assert.AreEqual("mysample", result.ValueAt(1)); + ClassicAssert.AreEqual("mysample", result.ValueAt(1)); } class SampleConverter: Converter { diff --git a/source/fitSharpTest/NUnit/Slim/SlimTreeTest.cs b/source/fitSharpTest/NUnit/Slim/SlimTreeTest.cs index 39367e55..7543db7a 100644 --- a/source/fitSharpTest/NUnit/Slim/SlimTreeTest.cs +++ b/source/fitSharpTest/NUnit/Slim/SlimTreeTest.cs @@ -8,6 +8,7 @@ using fitSharp.Machine.Model; using fitSharp.Slim.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fitSharp.Test.NUnit.Slim { [TestFixture] public class SlimTreeTest { @@ -60,10 +61,10 @@ static void AssertParsed(string input, IList results) { } static void ValidateTree(Tree result, IList results) { - Assert.AreEqual(results.Count, result.Branches.Count); + ClassicAssert.AreEqual(results.Count, result.Branches.Count); for (var i = 0; i < results.Count; i++) { var itemList = results[i] as IList; - if (itemList == null) Assert.AreEqual(results[i], result.ValueAt(i)); + if (itemList == null) ClassicAssert.AreEqual(results[i], result.ValueAt(i)); else ValidateTree(result.Branches[i], itemList); } } @@ -73,9 +74,9 @@ static void AssertParseError(string input) { SlimTree.Parse(input); } catch (FormatException) { - Assert.Pass(); + ClassicAssert.Pass(); } - Assert.Fail(); + ClassicAssert.Fail(); } } } diff --git a/source/fitSharpTest/fitSharpTest.csproj b/source/fitSharpTest/fitSharpTest.csproj index 5e1910a5..51ae4a1c 100644 --- a/source/fitSharpTest/fitSharpTest.csproj +++ b/source/fitSharpTest/fitSharpTest.csproj @@ -1,6 +1,6 @@  - net48;net6.0;net6.0-windows;net7.0;net7.0-windows;net8.0;net8.0-windows + net48;net8.0;net8.0-windows;net9.0;net9.0-windows fitSharp.Test false false @@ -8,8 +8,8 @@ - - + + diff --git a/source/fitSharpTest/fitSharpTestL.csproj b/source/fitSharpTest/fitSharpTestL.csproj index ce48ea6c..0f6d0daf 100644 --- a/source/fitSharpTest/fitSharpTestL.csproj +++ b/source/fitSharpTest/fitSharpTestL.csproj @@ -1,6 +1,6 @@  - net6.0 + net8.0 fitSharp.Test false false diff --git a/source/fitTest/NUnit/ActionFixtureTest.cs b/source/fitTest/NUnit/ActionFixtureTest.cs index 98143211..0189545e 100644 --- a/source/fitTest/NUnit/ActionFixtureTest.cs +++ b/source/fitTest/NUnit/ActionFixtureTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2010 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2010 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -10,6 +10,7 @@ using fitSharp.Machine.Model; using Moq; using NUnit.Framework; +using NUnit.Framework.Legacy; using TestStatus=fitSharp.Fit.Model.TestStatus; namespace fit.Test.NUnit { @@ -51,8 +52,8 @@ public void TestStart() table = BuildTable("ActionFixture"); var fixture = new ActionFixture { Processor = new Service.Service(memory) }; fixture.DoTable(table); - Assert.AreEqual(0, fixture.TestStatus.Counts.GetCount(TestStatus.Exception), table.ToString()); - Assert.IsNotNull(fixture.GetTargetObject()); + ClassicAssert.AreEqual(0, fixture.TestStatus.Counts.GetCount(TestStatus.Exception), table.ToString()); + ClassicAssert.IsNotNull(fixture.GetTargetObject()); } [Test] @@ -61,11 +62,11 @@ public void TestCheck() table = BuildTable("ActionFixture"); var fixture = new ActionFixture{ Processor = new Service.Service(memory) }; fixture.DoTable(table); - Assert.AreEqual(0, fixture.TestStatus.Counts.GetCount(TestStatus.Exception), table.ToString()); + ClassicAssert.AreEqual(0, fixture.TestStatus.Counts.GetCount(TestStatus.Exception), table.ToString()); var countFixture = (CountFixture)fixture.GetTargetObject(); int actualCount = countFixture.Counter; - Assert.AreEqual(6, actualCount); - Assert.AreEqual(4, fixture.TestStatus.Counts.GetCount(TestStatus.Right)); + ClassicAssert.AreEqual(6, actualCount); + ClassicAssert.AreEqual(4, fixture.TestStatus.Counts.GetCount(TestStatus.Right)); } [Test] @@ -74,11 +75,11 @@ public void TestCheckOnTimedActionFixture() table = BuildTable("TimedActionFixture"); var fixture = new ActionFixture{ Processor = new Service.Service(memory) }; fixture.DoTable(table); - Assert.AreEqual(0, fixture.TestStatus.Counts.GetCount(TestStatus.Exception), table.ToString()); + ClassicAssert.AreEqual(0, fixture.TestStatus.Counts.GetCount(TestStatus.Exception), table.ToString()); var countFixture = (CountFixture)fixture.GetTargetObject(); int actualCount = countFixture.Counter; - Assert.AreEqual(6, actualCount); - Assert.AreEqual(4, countFixture.TestStatus.Counts.GetCount(TestStatus.Right)); + ClassicAssert.AreEqual(6, actualCount); + ClassicAssert.AreEqual(4, countFixture.TestStatus.Counts.GetCount(TestStatus.Right)); } [Test] public void PressInvokesMethodOnActor() { diff --git a/source/fitTest/NUnit/BindingTest.cs b/source/fitTest/NUnit/BindingTest.cs index 3ba52126..61cc3a55 100644 --- a/source/fitTest/NUnit/BindingTest.cs +++ b/source/fitTest/NUnit/BindingTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2010 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2010 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -6,6 +6,7 @@ using System; using fitSharp.Fit.Service; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -19,34 +20,34 @@ public void TestSetterBinding() BindingOperation bindingOperation = new InputBinding(f.Processor, f, TestUtils.CreateCell("sampleInt")); bindingOperation.Do(MakeCell("123456")); - Assert.AreEqual(123456, f.sampleInt); + ClassicAssert.AreEqual(123456, f.sampleInt); bindingOperation.Do(MakeCell("-234567")); - Assert.AreEqual(-234567, f.sampleInt); + ClassicAssert.AreEqual(-234567, f.sampleInt); bindingOperation = new InputBinding(f.Processor, f, TestUtils.CreateCell("sampleDouble")); bindingOperation.Do(MakeCell("3.14159")); - Assert.AreEqual(3.14159, f.sampleDouble); + ClassicAssert.AreEqual(3.14159, f.sampleDouble); bindingOperation = new InputBinding(f.Processor, f, TestUtils.CreateCell("sampleChar")); bindingOperation.Do(MakeCell("a")); - Assert.AreEqual('a', f.sampleChar); + ClassicAssert.AreEqual('a', f.sampleChar); bindingOperation = new InputBinding(f.Processor, f, TestUtils.CreateCell("sampleString")); bindingOperation.Do(MakeCell("xyzzy")); - Assert.AreEqual("xyzzy", f.sampleString); + ClassicAssert.AreEqual("xyzzy", f.sampleString); bindingOperation = new InputBinding(f.Processor, f, TestUtils.CreateCell("sampleFloat")); bindingOperation.Do(MakeCell("6.02e23")); - Assert.AreEqual(6.02e23f, f.sampleFloat, 1e17f); + ClassicAssert.AreEqual(6.02e23f, f.sampleFloat, 1e17f); bindingOperation = new InputBinding(f.Processor, f, TestUtils.CreateCell("sampleByte")); bindingOperation.Do(MakeCell("123")); - Assert.AreEqual(123, f.sampleByte); + ClassicAssert.AreEqual(123, f.sampleByte); bindingOperation = new InputBinding(f.Processor, f, TestUtils.CreateCell("sampleShort")); bindingOperation.Do(MakeCell("12345")); - Assert.AreEqual(12345, f.sampleShort); + ClassicAssert.AreEqual(12345, f.sampleShort); } static Parse MakeCell(string cellContent) { diff --git a/source/fitTest/NUnit/CellHandlerLoaderTest.cs b/source/fitTest/NUnit/CellHandlerLoaderTest.cs index 99309c4a..11fa66fd 100644 --- a/source/fitTest/NUnit/CellHandlerLoaderTest.cs +++ b/source/fitTest/NUnit/CellHandlerLoaderTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2011 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2011 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -6,6 +6,7 @@ using fitSharp.Fit.Operators; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -21,10 +22,10 @@ public void TestLoadHandler() builder.Append("loadsubstring handler"); builder.Append(""); var service = new Service.Service(configuration); - Assert.IsFalse(service.Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); + ClassicAssert.IsFalse(service.Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); var test = builder.MakeStoryTest(service); test.Execute(); - Assert.IsTrue(service.Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); + ClassicAssert.IsTrue(service.Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); } [Test] @@ -38,10 +39,10 @@ public void TestRemoveHandler() builder.Append("CellHandlerLoader"); builder.Append("removeSubstringHandler"); builder.Append(""); - Assert.IsTrue(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); + ClassicAssert.IsTrue(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); var test = builder.MakeStoryTest(service); test.Execute(); - Assert.IsFalse(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); + ClassicAssert.IsFalse(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b.."))); } } } \ No newline at end of file diff --git a/source/fitTest/NUnit/CellMaking.cs b/source/fitTest/NUnit/CellMaking.cs index b007b284..f8281733 100644 --- a/source/fitTest/NUnit/CellMaking.cs +++ b/source/fitTest/NUnit/CellMaking.cs @@ -6,19 +6,20 @@ using fitlibrary.table; using fitSharp.Machine.Engine; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] public class CellMaking { [Test] public void CellIsMadeWithSimpleString() { var service = new Service.Service(); var cell = (Parse) service.Compose("something"); - Assert.AreEqual("something", cell.ToString()); + ClassicAssert.AreEqual("something", cell.ToString()); } [Test] public void CellIsMadeWithArray() { var service = new Service.Service(); var cell = (Parse) service.Compose(new [] {"something", "else"}); - Assert.AreEqual("something, else", cell.ToString()); + ClassicAssert.AreEqual("something, else", cell.ToString()); } [Test] public void CellIsMadeWithEmbeddedTable() { @@ -26,7 +27,7 @@ [Test] public void CellIsMadeWithEmbeddedTable() { Parse table = Parse.ParseFrom("
1112
2122
"); var cell = (Parse) service.Compose(new ParseTable(table)); - Assert.AreEqual("\n\n\n" + + ClassicAssert.AreEqual("\n", cell.ToString()); } } diff --git a/source/fitTest/NUnit/CellMatching.cs b/source/fitTest/NUnit/CellMatching.cs index 8feea8be..aca43333 100644 --- a/source/fitTest/NUnit/CellMatching.cs +++ b/source/fitTest/NUnit/CellMatching.cs @@ -1,4 +1,4 @@ -// Copyright © 2012 Syterra Software Inc. +// Copyright � 2012 Syterra Software Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -9,12 +9,13 @@ using fitSharp.Machine.Model; using TestStatus=fitSharp.Fit.Model.TestStatus; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] public class CellMatching { [Test] public void NullEqualsNullCell() { - Assert.IsTrue(IsEqual(new Parse("td", null, null, null), null)); + ClassicAssert.IsTrue(IsEqual(new Parse("td", null, null, null), null)); } private static bool IsEqual(Tree cell, object value) { @@ -22,54 +23,54 @@ private static bool IsEqual(Tree cell, object value) { } [Test] public void NullEqualsEmptyCell() { - Assert.IsTrue(IsEqual(new Parse("td", string.Empty, null, null), null)); + ClassicAssert.IsTrue(IsEqual(new Parse("td", string.Empty, null, null), null)); } [Test] public void NullDoesntEqualFullCell() { - Assert.IsFalse(IsEqual(new Parse("td", "something", null, null), null)); + ClassicAssert.IsFalse(IsEqual(new Parse("td", "something", null, null), null)); } [Test] public void StringEqualsSameStringCell() { - Assert.IsTrue(IsEqual(new Parse("td", "something", null, null), "something")); + ClassicAssert.IsTrue(IsEqual(new Parse("td", "something", null, null), "something")); } [Test] public void MarksSameStringCellAsRight() { var cell = new Parse("td", "something", null, null); var fixture = new Fixture {Processor = new Service.Service()}; fixture.Processor.Check(new TypedValue("something"), cell); - Assert.AreEqual("\n", cell.ToString()); + ClassicAssert.AreEqual("\n", cell.ToString()); } [Test] public void MarksSameArrayCellAsRight() { var cell = new Parse("td", "something,more", null, null); var fixture = new Fixture {Processor = new Service.Service()}; fixture.Processor.Check(new TypedValue(new [] {"something", "more"}), cell); - Assert.AreEqual("\n", cell.ToString()); + ClassicAssert.AreEqual("\n", cell.ToString()); } [Test] public void StringDoesntEqualDifferentStringCell() { - Assert.IsFalse(IsEqual(new Parse("td", "something else", null, null), "something")); + ClassicAssert.IsFalse(IsEqual(new Parse("td", "something else", null, null), "something")); } [Test] public void MarksDifferentStringCellAsWrong() { var cell = new Parse("td", "something else", null, null); var fixture = new Fixture {Processor = new Service.Service()}; fixture.Processor.Check(new TypedValue("something"), cell); - Assert.AreEqual(fitSharp.Fit.Model.TestStatus.Wrong, cell.GetAttribute(CellAttribute.Status)); - Assert.AreEqual("something", cell.GetAttribute(CellAttribute.Actual)); - Assert.IsTrue(cell.HasAttribute(CellAttribute.Difference)); + ClassicAssert.AreEqual(fitSharp.Fit.Model.TestStatus.Wrong, cell.GetAttribute(CellAttribute.Status)); + ClassicAssert.AreEqual("something", cell.GetAttribute(CellAttribute.Actual)); + ClassicAssert.IsTrue(cell.HasAttribute(CellAttribute.Difference)); } [Test] public void TreeEqualsSameTreeCell() { object actual = new ListTree(string.Empty, new []{new ListTree("a")}); Parse table = Parse.ParseFrom("
1112
\n\n" + "\n
1112
2122
somethingsomethingsomething,moresomething,more
  • a
"); - Assert.IsTrue(IsEqual(table.Parts.Parts, actual)); + ClassicAssert.IsTrue(IsEqual(table.Parts.Parts, actual)); } [Test] public void ListEqualsSameTableCell() { var actual = new ArrayList {new Name("joe", "smith")}; Parse table = Parse.ParseFrom("
firstlast
joesmith
"); - Assert.IsTrue(IsEqual(table.Parts.Parts, actual)); + ClassicAssert.IsTrue(IsEqual(table.Parts.Parts, actual)); } [Test] public void MarksSameTableCellAsRight() { @@ -78,8 +79,8 @@ [Test] public void MarksSameTableCellAsRight() { var fixture = new Fixture {Processor = new Service.Service()}; fixture.Processor.Check(new TypedValue(actual), table.Parts.Parts); var passRow = table.Parts.Parts.Parts.Parts.More; - Assert.AreEqual(TestStatus.Right, passRow.Parts.Value.GetAttribute(CellAttribute.Status)); - Assert.AreEqual(TestStatus.Right, passRow.Parts.More.Value.GetAttribute(CellAttribute.Status)); + ClassicAssert.AreEqual(TestStatus.Right, passRow.Parts.Value.GetAttribute(CellAttribute.Status)); + ClassicAssert.AreEqual(TestStatus.Right, passRow.Parts.More.Value.GetAttribute(CellAttribute.Status)); } [Test] public void MarksExtraTableHeaderAsError() { @@ -88,7 +89,7 @@ [Test] public void MarksExtraTableHeaderAsError() { var fixture = new Fixture {Processor = new Service.Service()}; fixture.Processor.Check(new TypedValue(actual), table.Parts.Parts); var errorCell = table.Parts.Parts.Parts.Parts.Parts.More.More.Value; - Assert.IsTrue(errorCell.HasAttribute(CellAttribute.Exception)); + ClassicAssert.IsTrue(errorCell.HasAttribute(CellAttribute.Exception)); } private class Name { diff --git a/source/fitTest/NUnit/CellOperatorTest.cs b/source/fitTest/NUnit/CellOperatorTest.cs index a710d88f..9db118ec 100644 --- a/source/fitTest/NUnit/CellOperatorTest.cs +++ b/source/fitTest/NUnit/CellOperatorTest.cs @@ -13,6 +13,7 @@ using fitSharp.Machine.Model; using fitSharp.Samples.Fit; using NUnit.Framework; +using NUnit.Framework.Legacy; using TestStatus=fitSharp.Fit.Model.TestStatus; namespace fit.Test.NUnit { @@ -63,17 +64,17 @@ public void MakeIntFixture() { public static void AssertCellPasses(Parse cell) { - Assert.AreEqual(TestStatus.Right, cell.GetAttribute(CellAttribute.Status)); + ClassicAssert.AreEqual(TestStatus.Right, cell.GetAttribute(CellAttribute.Status)); } public static void AssertCellFails(Parse cell) { - Assert.AreEqual(TestStatus.Wrong, cell.GetAttribute(CellAttribute.Status)); + ClassicAssert.AreEqual(TestStatus.Wrong, cell.GetAttribute(CellAttribute.Status)); } public static void AssertValueInBody(Parse cell, string value) { - Assert.IsTrue(cell.Body.IndexOf(value) > -1); + ClassicAssert.IsTrue(cell.Body.IndexOf(value) > -1); } public static void AssertValuesInBody(Parse cell, string[] values) diff --git a/source/fitTest/NUnit/ColumnFixtureTests.cs b/source/fitTest/NUnit/ColumnFixtureTests.cs index 4c549d77..07289dbd 100644 --- a/source/fitTest/NUnit/ColumnFixtureTests.cs +++ b/source/fitTest/NUnit/ColumnFixtureTests.cs @@ -1,4 +1,4 @@ -// Copyright © 2010 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2010 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -6,6 +6,7 @@ using System.Collections; using fitSharp.Fit.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -66,10 +67,10 @@ public void TestExecuteAtEnd() var table = builder.Parse.Parts; var testFixture = new ExecuteTestFixture { Processor = new Service.Service()}; testFixture.DoTable(table); - Assert.AreEqual(3, testFixture.Values.Count); - Assert.AreEqual("first call", testFixture.Values[0]); - Assert.AreEqual("second call", testFixture.Values[1]); - Assert.AreEqual("Execute()", testFixture.Values[2]); + ClassicAssert.AreEqual(3, testFixture.Values.Count); + ClassicAssert.AreEqual("first call", testFixture.Values[0]); + ClassicAssert.AreEqual("second call", testFixture.Values[1]); + ClassicAssert.AreEqual("Execute()", testFixture.Values[2]); } [Test] @@ -85,10 +86,10 @@ public void TestExecuteInMiddle() var table = builder.Parse.Parts; var testFixture = new ExecuteTestFixture { Processor = new Service.Service()}; testFixture.DoTable(table); - Assert.AreEqual(3, testFixture.Values.Count); - Assert.AreEqual("first call", testFixture.Values[0]); - Assert.AreEqual("Execute()", testFixture.Values[1]); - Assert.AreEqual("second call", testFixture.Values[2]); + ClassicAssert.AreEqual(3, testFixture.Values.Count); + ClassicAssert.AreEqual("first call", testFixture.Values[0]); + ClassicAssert.AreEqual("Execute()", testFixture.Values[1]); + ClassicAssert.AreEqual("second call", testFixture.Values[2]); } [Test] @@ -104,16 +105,16 @@ public void TestExecuteWithMethod() var table = builder.Parse.Parts; var testFixture = new ExecuteTestFixture { Processor = new Service.Service()}; testFixture.DoTable(table); - Assert.AreEqual(3, testFixture.Values.Count); - Assert.AreEqual("first call", testFixture.Values[0]); - Assert.AreEqual("Execute()", testFixture.Values[1]); - Assert.AreEqual("method!", testFixture.Values[2]); + ClassicAssert.AreEqual(3, testFixture.Values.Count); + ClassicAssert.AreEqual("first call", testFixture.Values[0]); + ClassicAssert.AreEqual("Execute()", testFixture.Values[1]); + ClassicAssert.AreEqual("method!", testFixture.Values[2]); } [Test] public void TestGetTargetObject() { Fixture fixture = new ExecuteTestFixture(); - Assert.AreEqual(fixture, fixture.GetTargetObject()); + ClassicAssert.AreEqual(fixture, fixture.GetTargetObject()); } [Test] @@ -145,11 +146,11 @@ public void TestExecuteDoesNotCauseMethodsToGetCalledThrice() var table = builder.Parse.Parts; var testFixture = new ExecuteTestFixture { Processor = new Service.Service()}; testFixture.DoTable(table); - Assert.AreEqual(4, testFixture.Values.Count); - Assert.AreEqual("Execute()", testFixture.Values[0]); - Assert.AreEqual("Method()", testFixture.Values[1]); - Assert.AreEqual("Execute()", testFixture.Values[2]); - Assert.AreEqual("Method()", testFixture.Values[3]); + ClassicAssert.AreEqual(4, testFixture.Values.Count); + ClassicAssert.AreEqual("Execute()", testFixture.Values[0]); + ClassicAssert.AreEqual("Method()", testFixture.Values[1]); + ClassicAssert.AreEqual("Execute()", testFixture.Values[2]); + ClassicAssert.AreEqual("Method()", testFixture.Values[3]); TestUtils.VerifyCounts(testFixture, 2, 0, 0, 0); } diff --git a/source/fitTest/NUnit/ComposeStoryTestHtmlTest.cs b/source/fitTest/NUnit/ComposeStoryTestHtmlTest.cs index 085e9a7b..c08484d7 100644 --- a/source/fitTest/NUnit/ComposeStoryTestHtmlTest.cs +++ b/source/fitTest/NUnit/ComposeStoryTestHtmlTest.cs @@ -7,6 +7,7 @@ using fitSharp.Machine.Engine; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] public class ComposeStoryTestHtmlTest { @@ -15,16 +16,16 @@ [Test] public void HtmlStringIsParsed() { var service = new Service.Service(); var result = service.Compose(StoryTestSource.FromString("
hello
")); var table = ((Parse)result).Parts; - Assert.AreEqual("", table.Tag); + ClassicAssert.AreEqual("
", table.Tag); var cell = table.Parts.Parts; - Assert.AreEqual("
", cell.Tag); - Assert.AreEqual("hello", cell.Body); + ClassicAssert.AreEqual("", cell.Tag); + ClassicAssert.AreEqual("hello", cell.Body); } [Test] public void NoTablesReturnsEmptyTree() { var service = new Service.Service(); var result = service.Compose(StoryTestSource.FromString("stuff")); - Assert.AreEqual(0, result.Branches.Count); + ClassicAssert.AreEqual(0, result.Branches.Count); } [Test] public void SimpleHtmlStringIsGenerated() { @@ -43,7 +44,7 @@ static void CheckRoundTrip(string input) { var service = new Service.Service(); var source = service.Compose(StoryTestSource.FromString(input)); var result = source.WriteBranches(); - Assert.AreEqual(input, result); + ClassicAssert.AreEqual(input, result); } } } diff --git a/source/fitTest/NUnit/DefaultCellHandlerTest.cs b/source/fitTest/NUnit/DefaultCellHandlerTest.cs index df3fffa3..8faee41d 100644 --- a/source/fitTest/NUnit/DefaultCellHandlerTest.cs +++ b/source/fitTest/NUnit/DefaultCellHandlerTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2011 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2011 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -8,6 +8,7 @@ using fitSharp.Fit.Model; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; using TestStatus=fitSharp.Fit.Model.TestStatus; namespace fit.Test.NUnit { @@ -21,7 +22,7 @@ public void TestDoInput() Parse cell = TestUtils.CreateCell("xyz"); MakeStringFixture(); TestUtils.DoInput(stringFixture, TestUtils.CreateCellRange("Field"), cell); - Assert.AreEqual("xyz", stringFixture.Field); + ClassicAssert.AreEqual("xyz", stringFixture.Field); TestUtils.VerifyCounts(stringFixture, 0, 0, 0, 0); } @@ -43,8 +44,8 @@ public void TestDoCheckCellWrong() { stringFixture.Field = "abc"; TestUtils.DoCheck(stringFixture, TestUtils.CreateCellRange("Field"), cell); AssertCellFails(cell); - Assert.IsTrue(cell.Body.IndexOf("abc") > -1); - Assert.IsTrue(cell.Body.IndexOf("xyz") > -1); + ClassicAssert.IsTrue(cell.Body.IndexOf("abc") > -1); + ClassicAssert.IsTrue(cell.Body.IndexOf("xyz") > -1); TestUtils.VerifyCounts(stringFixture, 0, 1, 0, 0); } @@ -55,8 +56,8 @@ public void TestDoCheckCellWrongNull() { stringFixture.Field = null; TestUtils.DoCheck(stringFixture, TestUtils.CreateCellRange("Field"), cell); AssertCellFails(cell); - Assert.IsTrue(cell.Body.IndexOf("null") > -1); - Assert.IsTrue(cell.Body.IndexOf("xyz") > -1); + ClassicAssert.IsTrue(cell.Body.IndexOf("null") > -1); + ClassicAssert.IsTrue(cell.Body.IndexOf("xyz") > -1); TestUtils.VerifyCounts(stringFixture, 0, 1, 0, 0); } @@ -69,7 +70,7 @@ public void TestInvoke() service = new Service.Service(); var fixture = new FixtureWithExecutableMethod {Processor = service}; fixture.Processor.Execute(fixture, new CellRange(cell, 1), new CellTree()); - Assert.AreEqual(1, FixtureWithExecutableMethod.Calls); + ClassicAssert.AreEqual(1, FixtureWithExecutableMethod.Calls); } [Test] @@ -77,10 +78,10 @@ public void TestEvaluateWrong() { Parse cell = TestUtils.CreateCell("xyz"); MakeStringFixture(); stringFixture.Field = "abc"; - Assert.IsFalse(service.Compare(new TypedValue("abc"), cell)); - Assert.AreNotEqual(TestStatus.Wrong, cell.GetAttribute(CellAttribute.Status)); - Assert.IsFalse(cell.Body.IndexOf("abc") > -1); - Assert.IsTrue(cell.Body.IndexOf("xyz") > -1); + ClassicAssert.IsFalse(service.Compare(new TypedValue("abc"), cell)); + ClassicAssert.AreNotEqual(TestStatus.Wrong, cell.GetAttribute(CellAttribute.Status)); + ClassicAssert.IsFalse(cell.Body.IndexOf("abc") > -1); + ClassicAssert.IsTrue(cell.Body.IndexOf("xyz") > -1); TestUtils.VerifyCounts(stringFixture, 0, 0, 0, 0); } @@ -90,8 +91,8 @@ public void TestEvaluateRight() { Parse cell = TestUtils.CreateCell("xyz"); MakeStringFixture(); stringFixture.Field = "xyz"; - Assert.IsTrue(service.Compare(new TypedValue("xyz"), cell)); - Assert.AreNotEqual(TestStatus.Right, cell.GetAttribute(CellAttribute.Status)); + ClassicAssert.IsTrue(service.Compare(new TypedValue("xyz"), cell)); + ClassicAssert.AreNotEqual(TestStatus.Right, cell.GetAttribute(CellAttribute.Status)); TestUtils.VerifyCounts(stringFixture, 0, 0, 0, 0); } diff --git a/source/fitTest/NUnit/EmptyCellHandlerTest.cs b/source/fitTest/NUnit/EmptyCellHandlerTest.cs index 828d3942..2d993b2b 100644 --- a/source/fitTest/NUnit/EmptyCellHandlerTest.cs +++ b/source/fitTest/NUnit/EmptyCellHandlerTest.cs @@ -1,10 +1,11 @@ -// Copyright © 2011 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2011 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. using fitSharp.Fit.Operators; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -19,14 +20,14 @@ public void SetUp() { [Test] public void TestMatch() { - Assert.IsTrue(IsMatch(new CheckEmpty(), "")); + ClassicAssert.IsTrue(IsMatch(new CheckEmpty(), "")); } [Test] public void TestInputWhereNullValueExists() { MakeStringFixture(); TestUtils.DoInput(stringFixture, TestUtils.CreateCellRange("Field"), cell); - Assert.AreEqual(null, stringFixture.Field); + ClassicAssert.AreEqual(null, stringFixture.Field); AssertValuesInBody(cell, new [] {"fit_grey", "null"}); TestUtils.VerifyCounts(stringFixture, 0, 0, 0, 0); } @@ -36,7 +37,7 @@ public void TestInputWhereBlankValueExists() { MakeStringFixture(); stringFixture.Field = ""; TestUtils.DoInput(stringFixture, TestUtils.CreateCellRange("Field"), cell); - Assert.AreEqual("", stringFixture.Field); + ClassicAssert.AreEqual("", stringFixture.Field); AssertValuesInBody(cell, new [] {"fit_grey", "blank"}); TestUtils.VerifyCounts(stringFixture, 0, 0, 0, 0); } @@ -46,7 +47,7 @@ public void TestInputWhereValueExists() { MakeIntFixture(); intFixture.Field = 37; TestUtils.DoInput(intFixture, TestUtils.CreateCellRange("Field"), cell); - Assert.AreEqual(37, intFixture.Field); + ClassicAssert.AreEqual(37, intFixture.Field); AssertValuesInBody(cell, new [] {"fit_grey", "37"}); TestUtils.VerifyCounts(intFixture, 0, 0, 0, 0); } @@ -55,7 +56,7 @@ public void TestInputWhereValueExists() { public void TestInputNullValueWithMethod() { MakeStringFixture(); TestUtils.DoInput(stringFixture, TestUtils.CreateCellRange("Set"), cell); - Assert.AreEqual(null, stringFixture.Field); + ClassicAssert.AreEqual(null, stringFixture.Field); TestUtils.VerifyCounts(stringFixture, 0, 0, 0, 0); } diff --git a/source/fitTest/NUnit/EndsWithHandlerTest.cs b/source/fitTest/NUnit/EndsWithHandlerTest.cs index 252e07a3..b5d1d591 100644 --- a/source/fitTest/NUnit/EndsWithHandlerTest.cs +++ b/source/fitTest/NUnit/EndsWithHandlerTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2009 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2009 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -6,6 +6,7 @@ using fitSharp.Fit.Operators; using fitSharp.Machine.Application; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -22,9 +23,9 @@ public void SetUp() [Test] public void MatchesInput() { - Assert.IsFalse(IsMatch("abc..")); - Assert.IsTrue(IsMatch("..abc")); - Assert.IsFalse(IsMatch("..abc..")); + ClassicAssert.IsFalse(IsMatch("abc..")); + ClassicAssert.IsTrue(IsMatch("..abc")); + ClassicAssert.IsFalse(IsMatch("..abc..")); } private static bool IsMatch(string input) { diff --git a/source/fitTest/NUnit/ErrorKeywordHandlerTest.cs b/source/fitTest/NUnit/ErrorKeywordHandlerTest.cs index 3252a2c5..25659131 100644 --- a/source/fitTest/NUnit/ErrorKeywordHandlerTest.cs +++ b/source/fitTest/NUnit/ErrorKeywordHandlerTest.cs @@ -1,10 +1,11 @@ -// Copyright © 2011 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2011 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. using fitSharp.Fit.Operators; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -15,7 +16,7 @@ public class ErrorKeywordHandlerTest: CellOperatorTest [Test] public void MatchesErrorKeyword() { - Assert.IsTrue(IsMatch(new CompareError(), "error")); + ClassicAssert.IsTrue(IsMatch(new CompareError(), "error")); } [Test] @@ -25,7 +26,7 @@ public void TestDoCheckErrorRight() MakeErrorFixture(); TestUtils.DoCheck(fixture, TestUtils.CreateCellRange("ErrorThrowingMethod"), cell); AssertCellPasses(cell); - Assert.IsTrue(cell.Body.IndexOf("error") > -1); + ClassicAssert.IsTrue(cell.Body.IndexOf("error") > -1); TestUtils.VerifyCounts(fixture, 1, 0, 0, 0); } @@ -37,8 +38,8 @@ public void TestDoCheckErrorWrong() stringFixture.Field = "some value"; TestUtils.DoCheck(stringFixture, TestUtils.CreateCellRange("field"), cell); AssertCellFails(cell); - Assert.IsTrue(cell.Body.IndexOf("error") > -1); - Assert.IsTrue(cell.Body.IndexOf("some value") > -1); + ClassicAssert.IsTrue(cell.Body.IndexOf("error") > -1); + ClassicAssert.IsTrue(cell.Body.IndexOf("some value") > -1); TestUtils.VerifyCounts(stringFixture, 0, 1, 0, 0); } diff --git a/source/fitTest/NUnit/ExceptionKeywordHandlerTest.cs b/source/fitTest/NUnit/ExceptionKeywordHandlerTest.cs index 0ea399fe..7e11cf30 100644 --- a/source/fitTest/NUnit/ExceptionKeywordHandlerTest.cs +++ b/source/fitTest/NUnit/ExceptionKeywordHandlerTest.cs @@ -1,10 +1,11 @@ -// Copyright © 2011 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2011 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. using fitSharp.Fit.Operators; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -15,8 +16,8 @@ public class ExceptionKeywordHandlerTest: CellOperatorTest [Test] public void TestMatch() { - Assert.IsTrue(IsMatch(new CompareException(), "exception[]")); - Assert.IsTrue(IsMatch(new CompareException(), "exception[NullPointerException]")); + ClassicAssert.IsTrue(IsMatch(new CompareException(), "exception[]")); + ClassicAssert.IsTrue(IsMatch(new CompareException(), "exception[NullPointerException]")); } diff --git a/source/fitTest/NUnit/FailKeywordHandlerTest.cs b/source/fitTest/NUnit/FailKeywordHandlerTest.cs index e3a5304f..01340231 100644 --- a/source/fitTest/NUnit/FailKeywordHandlerTest.cs +++ b/source/fitTest/NUnit/FailKeywordHandlerTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2009 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2009 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -6,6 +6,7 @@ using fitSharp.Fit.Operators; using fitSharp.Samples; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -14,8 +15,8 @@ public class FailKeywordHandlerTest: CellOperatorTest [Test] public void TestMatch() { - Assert.IsTrue(IsMatch("fail[]")); - Assert.IsTrue(IsMatch("fail[some value]")); + ClassicAssert.IsTrue(IsMatch("fail[]")); + ClassicAssert.IsTrue(IsMatch("fail[some value]")); } private static bool IsMatch(string input) { diff --git a/source/fitTest/NUnit/FixtureNUnitTest.cs b/source/fitTest/NUnit/FixtureNUnitTest.cs index d6aa8e45..86488087 100644 --- a/source/fitTest/NUnit/FixtureNUnitTest.cs +++ b/source/fitTest/NUnit/FixtureNUnitTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2011 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2011 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -10,6 +10,7 @@ using fitSharp.Samples.Fit; using NUnit.Framework; using fitSharp.Machine.Application; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -21,7 +22,7 @@ public void NoParameterCellsShouldResultInNoArguments() const string tableString = "
StringFixture
fieldfield
"; Fixture stringFixture = new StringFixture(); stringFixture.Prepare(null, Parse.ParseFrom(tableString).Parts); - Assert.AreEqual(0, stringFixture.Args.Length); + ClassicAssert.AreEqual(0, stringFixture.Args.Length); } [Test] @@ -31,8 +32,8 @@ public void OneParameterCellShouldResultInOneArgument() const string tableString = "
StringFixture" + arg + "
fieldfield
"; Fixture stringFixture = new StringFixture(); stringFixture.Prepare(null, Parse.ParseFrom(tableString).Parts); - Assert.AreEqual(1, stringFixture.Args.Length); - Assert.AreEqual(arg, stringFixture.Args[0]); + ClassicAssert.AreEqual(1, stringFixture.Args.Length); + ClassicAssert.AreEqual(arg, stringFixture.Args[0]); } [Test] @@ -43,9 +44,9 @@ public void TwoParameterCellShouldResultInTwoArguments() const string tableString = "
StringFixture" + arg1 + "" + arg2 + "
fieldfield
"; Fixture stringFixture = new StringFixture(); stringFixture.Prepare(null, Parse.ParseFrom(tableString).Parts); - Assert.AreEqual(2, stringFixture.Args.Length); - Assert.AreEqual(arg1, stringFixture.Args[0]); - Assert.AreEqual(arg2, stringFixture.Args[1]); + ClassicAssert.AreEqual(2, stringFixture.Args.Length); + ClassicAssert.AreEqual(arg1, stringFixture.Args[0]); + ClassicAssert.AreEqual(arg2, stringFixture.Args[1]); } } @@ -56,15 +57,15 @@ public class EscapeTest public void TestEscape() { const string junk = "!@#$%^*()_-+={}|[]\\:\";',./?`"; - Assert.AreEqual(junk, Fixture.Escape(junk)); - Assert.AreEqual("", Fixture.Escape("")); - Assert.AreEqual("<", Fixture.Escape("<")); - Assert.AreEqual("<<", Fixture.Escape("<<")); - Assert.AreEqual("x<", Fixture.Escape("x<")); - Assert.AreEqual("&", Fixture.Escape("&")); - Assert.AreEqual("<&<", Fixture.Escape("<&<")); - Assert.AreEqual("&<&", Fixture.Escape("&<&")); - Assert.AreEqual("a < b && c < d", Fixture.Escape("a < b && c < d")); + ClassicAssert.AreEqual(junk, Fixture.Escape(junk)); + ClassicAssert.AreEqual("", Fixture.Escape("")); + ClassicAssert.AreEqual("<", Fixture.Escape("<")); + ClassicAssert.AreEqual("<<", Fixture.Escape("<<")); + ClassicAssert.AreEqual("x<", Fixture.Escape("x<")); + ClassicAssert.AreEqual("&", Fixture.Escape("&")); + ClassicAssert.AreEqual("<&<", Fixture.Escape("<&<")); + ClassicAssert.AreEqual("&<&", Fixture.Escape("&<&")); + ClassicAssert.AreEqual("a < b && c < d", Fixture.Escape("a < b && c < d")); } } @@ -86,7 +87,7 @@ public void TestProcessorContextDataIsExposedToFixture() { // I admit this test is a little forced, but I have another test verifying that // the context is populated by SuiteRunner, so it makes sense to test // that the fixture sees the change, too. To me, anyway. - Assert.AreEqual(@"\some\path.html", fixture.Processor.Get().TestPagePath.ToString()); + ClassicAssert.AreEqual(@"\some\path.html", fixture.Processor.Get().TestPagePath.ToString()); } } @@ -108,9 +109,9 @@ public void TestSaveAndRecallValue() { const string key = "aVariable"; const string value = "aValue"; - Assert.IsNull(fixture.Symbols.GetValueOrDefault(key, null)); + ClassicAssert.IsNull(fixture.Symbols.GetValueOrDefault(key, null)); fixture.Symbols.Save(key, value); - Assert.AreEqual(value, fixture.Symbols.GetValueOrDefault(key, null)); + ClassicAssert.AreEqual(value, fixture.Symbols.GetValueOrDefault(key, null)); } [Test] @@ -120,11 +121,11 @@ public void TestSaveAndRecallTwoValues() const string value = "aValue"; const string otherKey = "anotherVariable"; const string otherValue = "anotherValue"; - Assert.IsNull(fixture.Symbols.GetValueOrDefault(key, null)); + ClassicAssert.IsNull(fixture.Symbols.GetValueOrDefault(key, null)); fixture.Symbols.Save(key, value); fixture.Symbols.Save(otherKey, otherValue); - Assert.AreEqual(value, fixture.Symbols.GetValueOrDefault(key, null)); - Assert.AreEqual(otherValue, fixture.Symbols.GetValueOrDefault(otherKey, null)); + ClassicAssert.AreEqual(value, fixture.Symbols.GetValueOrDefault(key, null)); + ClassicAssert.AreEqual(otherValue, fixture.Symbols.GetValueOrDefault(otherKey, null)); } [Test] @@ -135,13 +136,13 @@ public void TestSaveAndRecallChangedValue() const string otherValue = "anotherValue"; fixture.Symbols.Save(key, value); fixture.Symbols.Save(key, otherValue); - Assert.AreEqual(otherValue, fixture.Symbols.GetValueOrDefault(key, null)); + ClassicAssert.AreEqual(otherValue, fixture.Symbols.GetValueOrDefault(key, null)); } [Test] public void TestGetTargetType() { - Assert.AreSame(fixture, fixture.GetTargetObject()); + ClassicAssert.AreSame(fixture, fixture.GetTargetObject()); } } diff --git a/source/fitTest/NUnit/FixtureTableTest.cs b/source/fitTest/NUnit/FixtureTableTest.cs index b5910218..09b24678 100644 --- a/source/fitTest/NUnit/FixtureTableTest.cs +++ b/source/fitTest/NUnit/FixtureTableTest.cs @@ -1,10 +1,11 @@ -// Copyright © 2009 Syterra Software Inc. +// Copyright � 2009 Syterra Software Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. using fit.Operators; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] public class FixtureTableTest { @@ -12,13 +13,13 @@ [TestFixture] public class FixtureTableTest { [Test] public void EmptyTablesMatch() { var table1 = new FixtureTable(null); var table2 = new FixtureTable(null); - Assert.AreEqual(string.Empty, table1.Differences(table2)); + ClassicAssert.AreEqual(string.Empty, table1.Differences(table2)); } [Test] public void EmptyAndNonEmptyDifferent() { var table1 = new FixtureTable(Parse.ParseFrom("
actual
")); var table2 = new FixtureTable(null); - Assert.AreEqual("expected: null, was ''", table1.Differences(table2)); + ClassicAssert.AreEqual("expected: null, was '
'", table1.Differences(table2)); } [Test] public void TableCellsDifferent() { @@ -28,7 +29,7 @@ [Test] public void TableCellsDifferent() { var table2 = new FixtureTable(Parse.ParseFrom( "
sameexpected
")); - Assert.AreEqual("in , in , in
body, expected: 'expected', was 'actual'", table1.Differences(table2)); + ClassicAssert.AreEqual("in , in , in
body, expected: 'expected', was 'actual'", table1.Differences(table2)); } [Test] public void TableCellTagsDifferent() { @@ -38,7 +39,7 @@ [Test] public void TableCellTagsDifferent() { var table2 = new FixtureTable(Parse.ParseFrom( "
same
")); - Assert.AreEqual("in , in , expected: '
', was ''", table1.Differences(table2)); + ClassicAssert.AreEqual("in , in , expected: '" + "" + "\n", @@ -430,7 +431,7 @@ public void TestArrayOfStrings() var testTable = new TestBuilder(tableHtml).Parse; RunTest(new ArrayOfStringsFixture(), new TestBuilder(setUpTableHtml).Parse); RunTest(new ArrayOfStringsRowFixture(), testTable); - Assert.AreEqual(TestStatus.Right, + ClassicAssert.AreEqual(TestStatus.Right, testTable.Parts.Parts.More.More.Parts.Value.GetAttribute(CellAttribute.Status)); } @@ -469,17 +470,17 @@ void AddRow(string[] strings) static void AssertTextInTag(Cell cell, string text) { - Assert.AreEqual(text, cell.GetAttribute(CellAttribute.Status)); + ClassicAssert.AreEqual(text, cell.GetAttribute(CellAttribute.Status)); } static void AssertTextInBody(Parse cell, string text) { - Assert.IsTrue(cell.Body.IndexOf(text, StringComparison.Ordinal) > -1); + ClassicAssert.IsTrue(cell.Body.IndexOf(text, StringComparison.Ordinal) > -1); } static void AssertTextNotInBody(Parse cell, string text) { - Assert.IsFalse(cell.Body.IndexOf(text, StringComparison.Ordinal) > -1); + ClassicAssert.IsFalse(cell.Body.IndexOf(text, StringComparison.Ordinal) > -1); } static void AddColumn(Parse table, string name) diff --git a/source/fitTest/NUnit/ScientificDoubleTest.cs b/source/fitTest/NUnit/ScientificDoubleTest.cs index 94520c06..5d610bc1 100644 --- a/source/fitTest/NUnit/ScientificDoubleTest.cs +++ b/source/fitTest/NUnit/ScientificDoubleTest.cs @@ -1,9 +1,10 @@ -// Copyright © 2010 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2010 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -14,21 +15,21 @@ public class ScientificDoubleTest public void TestScientificDouble() { double pi = 3.141592865; - Assert.AreEqual(ScientificDouble.ValueOf("3.14"), pi); - Assert.AreEqual(ScientificDouble.ValueOf("3.142"), pi); - Assert.AreEqual(ScientificDouble.ValueOf("3.1416"), pi); - Assert.AreEqual(ScientificDouble.ValueOf("3.14159"), pi); - Assert.AreEqual(ScientificDouble.ValueOf("3.141592865"), pi); - Assert.IsTrue(!ScientificDouble.ValueOf("3.140").Equals(pi)); - Assert.IsTrue(!ScientificDouble.ValueOf("3.144").Equals(pi)); - Assert.IsTrue(!ScientificDouble.ValueOf("3.1414").Equals(pi)); - Assert.IsTrue(!ScientificDouble.ValueOf("3.141592863").Equals(pi)); - Assert.AreEqual(ScientificDouble.ValueOf("6.02e23"), 6.02e23d); - Assert.AreEqual(ScientificDouble.ValueOf("6.02E23"), 6.024E23d); - Assert.AreEqual(ScientificDouble.ValueOf("6.02e23"), 6.016e23d); - Assert.IsTrue(!ScientificDouble.ValueOf("6.02e23").Equals(6.026e23d)); - Assert.IsTrue(!ScientificDouble.ValueOf("6.02e23").Equals(6.014e23d)); - Assert.AreEqual(ScientificDouble.ValueOf("3.14"), ScientificDouble.ValueOf("3.14")); + ClassicAssert.AreEqual(ScientificDouble.ValueOf("3.14"), pi); + ClassicAssert.AreEqual(ScientificDouble.ValueOf("3.142"), pi); + ClassicAssert.AreEqual(ScientificDouble.ValueOf("3.1416"), pi); + ClassicAssert.AreEqual(ScientificDouble.ValueOf("3.14159"), pi); + ClassicAssert.AreEqual(ScientificDouble.ValueOf("3.141592865"), pi); + ClassicAssert.IsTrue(!ScientificDouble.ValueOf("3.140").Equals(pi)); + ClassicAssert.IsTrue(!ScientificDouble.ValueOf("3.144").Equals(pi)); + ClassicAssert.IsTrue(!ScientificDouble.ValueOf("3.1414").Equals(pi)); + ClassicAssert.IsTrue(!ScientificDouble.ValueOf("3.141592863").Equals(pi)); + ClassicAssert.AreEqual(ScientificDouble.ValueOf("6.02e23"), 6.02e23d); + ClassicAssert.AreEqual(ScientificDouble.ValueOf("6.02E23"), 6.024E23d); + ClassicAssert.AreEqual(ScientificDouble.ValueOf("6.02e23"), 6.016e23d); + ClassicAssert.IsTrue(!ScientificDouble.ValueOf("6.02e23").Equals(6.026e23d)); + ClassicAssert.IsTrue(!ScientificDouble.ValueOf("6.02e23").Equals(6.014e23d)); + ClassicAssert.AreEqual(ScientificDouble.ValueOf("3.14"), ScientificDouble.ValueOf("3.14")); } } } \ No newline at end of file diff --git a/source/fitTest/NUnit/SocketServerTest.cs b/source/fitTest/NUnit/SocketServerTest.cs index 5a5760d8..2fb35358 100644 --- a/source/fitTest/NUnit/SocketServerTest.cs +++ b/source/fitTest/NUnit/SocketServerTest.cs @@ -12,6 +12,7 @@ using fitSharp.Machine.Model; using fitSharp.Samples; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] public class SocketServerTest { @@ -26,13 +27,13 @@ [Test] public void StoryTestIsExecuted() { service.AddNamespace("fitlibrary"); service.ApplicationUnderTest.AddAssembly(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "fit.dll")); RunTest(service, "
', was ''", table1.Differences(table2)); } [Test] public void EmptyTableCellsMatch() { @@ -48,7 +49,7 @@ [Test] public void EmptyTableCellsMatch() { var table2 = new FixtureTable(Parse.ParseFrom( "
same
")); - Assert.AreEqual(string.Empty, table1.Differences(table2)); + ClassicAssert.AreEqual(string.Empty, table1.Differences(table2)); } [Test] public void StackTraceStartsWithExpectedMatches() { @@ -58,7 +59,7 @@ [Test] public void StackTraceStartsWithExpectedMatches() { var table2 = new FixtureTable(Parse.ParseFrom( "
samestack trace
>")); - Assert.AreEqual(string.Empty, table1.Differences(table2)); + ClassicAssert.AreEqual(string.Empty, table1.Differences(table2)); } [Test] public void StackTraceWithoutExceptionNameMatches() { @@ -68,7 +69,7 @@ [Test] public void StackTraceWithoutExceptionNameMatches() { var table2 = new FixtureTable(Parse.ParseFrom( "
samestack: trace
>")); - Assert.AreEqual(string.Empty, table1.Differences(table2)); + ClassicAssert.AreEqual(string.Empty, table1.Differences(table2)); } [Test] public void StackTraceEmptyExpectedMatches() { @@ -78,7 +79,7 @@ [Test] public void StackTraceEmptyExpectedMatches() { var table2 = new FixtureTable(Parse.ParseFrom( "
same
>")); - Assert.AreEqual(string.Empty, table1.Differences(table2)); + ClassicAssert.AreEqual(string.Empty, table1.Differences(table2)); } [Test] public void StackTraceNoneExpectedDifferent() { @@ -88,7 +89,7 @@ [Test] public void StackTraceNoneExpectedDifferent() { var table2 = new FixtureTable(Parse.ParseFrom( "
same
>")); - Assert.AreEqual("in , in , in
body, expected: null, was 'stack trace blah blah'", table1.Differences(table2)); + ClassicAssert.AreEqual("in , in , in
body, expected: null, was 'stack trace blah blah'", table1.Differences(table2)); } } diff --git a/source/fitTest/NUnit/FolderRunnerTest.cs b/source/fitTest/NUnit/FolderRunnerTest.cs index 24afc283..54b652c1 100644 --- a/source/fitTest/NUnit/FolderRunnerTest.cs +++ b/source/fitTest/NUnit/FolderRunnerTest.cs @@ -8,6 +8,7 @@ using fitSharp.Machine.Application; using fit.Runner; using fitSharp.IO; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] public class FolderRunnerTest { @@ -24,9 +25,9 @@ [Test] public void ParsingOfDryRunInputAndOutputFolderIsDoneCorrectly() { var runner = new FolderRunner(); runner.Run(new[] { "-d", "-i", "overridden_in", "-o", "overridden_out" }, memory, new NullReporter()); - Assert.AreEqual(true, memory.GetItem().DryRun); - Assert.AreEqual("overridden_in", memory.GetItem().InputFolder); - Assert.AreEqual("overridden_out", memory.GetItem().OutputFolder); + ClassicAssert.AreEqual(true, memory.GetItem().DryRun); + ClassicAssert.AreEqual("overridden_in", memory.GetItem().InputFolder); + ClassicAssert.AreEqual("overridden_out", memory.GetItem().OutputFolder); } [Test] public void DryRunSuppressesSummaryReport() { @@ -37,7 +38,7 @@ [Test] public void DryRunSuppressesSummaryReport() { var runner = new FolderRunner(); runner.Run(new string[] {}, memory, reporter); - Assert.AreEqual(string.Empty, reporter.Output); + ClassicAssert.AreEqual(string.Empty, reporter.Output); } } } diff --git a/source/fitTest/NUnit/IntegralRangeHandlerTest.cs b/source/fitTest/NUnit/IntegralRangeHandlerTest.cs index ca9650a3..d81a8201 100644 --- a/source/fitTest/NUnit/IntegralRangeHandlerTest.cs +++ b/source/fitTest/NUnit/IntegralRangeHandlerTest.cs @@ -1,10 +1,11 @@ -// Copyright © 2009 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2009 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. using fitSharp.Fit.Operators; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -19,13 +20,13 @@ public void SetUp() { [Test] public void MatchesInput() { - Assert.IsTrue(IsMatch("0..2")); - Assert.IsFalse(IsMatch("..2")); - Assert.IsFalse(IsMatch("..")); - Assert.IsTrue(IsMatch("-10..-2")); - Assert.IsTrue(IsMatch("-10..23")); - Assert.IsTrue(IsMatch("12..37")); - Assert.IsFalse(IsMatch("a..b")); + ClassicAssert.IsTrue(IsMatch("0..2")); + ClassicAssert.IsFalse(IsMatch("..2")); + ClassicAssert.IsFalse(IsMatch("..")); + ClassicAssert.IsTrue(IsMatch("-10..-2")); + ClassicAssert.IsTrue(IsMatch("-10..23")); + ClassicAssert.IsTrue(IsMatch("12..37")); + ClassicAssert.IsFalse(IsMatch("a..b")); } private static bool IsMatch(string input) { diff --git a/source/fitTest/NUnit/NamedMatchStrategyTest.cs b/source/fitTest/NUnit/NamedMatchStrategyTest.cs index 65d07bbb..4b4dc71a 100644 --- a/source/fitTest/NUnit/NamedMatchStrategyTest.cs +++ b/source/fitTest/NUnit/NamedMatchStrategyTest.cs @@ -7,6 +7,7 @@ using fit.Operators; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] public class NamedMatchStrategyTest { @@ -31,9 +32,9 @@ private static void AssertGetsActuals(string columnName, string headerName) { var strategy = new TestStrategy(new Parse("tr", string.Empty, new Parse("td", headerName, null, null), null)); TypedValue[] values = strategy.ActualValues(row); - Assert.AreEqual(1, values.Length); - Assert.AreEqual(typeof(string), values[0].Type); - Assert.AreEqual("hi", values[0].Value); + ClassicAssert.AreEqual(1, values.Length); + ClassicAssert.AreEqual(typeof(string), values[0].Type); + ClassicAssert.AreEqual("hi", values[0].Value); } class TestStrategy: NamedMatchStrategy { diff --git a/source/fitTest/NUnit/NullKeywordHandlerTest.cs b/source/fitTest/NUnit/NullKeywordHandlerTest.cs index db2ad05a..43ed9d9c 100644 --- a/source/fitTest/NUnit/NullKeywordHandlerTest.cs +++ b/source/fitTest/NUnit/NullKeywordHandlerTest.cs @@ -1,10 +1,11 @@ -// Copyright © 2009 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2009 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. using fitSharp.Fit.Operators; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -12,7 +13,7 @@ public class NullKeywordHandlerTest: CellOperatorTest { [Test] public void MatchesNullString() { - Assert.IsTrue(IsMatch(new ParseNull(), "null")); + ClassicAssert.IsTrue(IsMatch(new ParseNull(), "null")); } [Test] @@ -21,7 +22,7 @@ public void TestDoInputNull() Parse cell = TestUtils.CreateCell("null"); MakeStringFixture(); TestUtils.DoInput(stringFixture, TestUtils.CreateCellRange("Field"), cell); - Assert.AreEqual(null, stringFixture.Field); + ClassicAssert.AreEqual(null, stringFixture.Field); TestUtils.VerifyCounts(stringFixture, 0, 0, 0, 0); } @@ -32,9 +33,9 @@ public void TestDoCheckNullRight() MakeStringFixture(); stringFixture.Field = null; TestUtils.DoCheck(stringFixture, TestUtils.CreateCellRange("field"), cell); - Assert.AreEqual(null, stringFixture.Field); + ClassicAssert.AreEqual(null, stringFixture.Field); AssertCellPasses(cell); - Assert.IsTrue(cell.Body.IndexOf("null") > -1); + ClassicAssert.IsTrue(cell.Body.IndexOf("null") > -1); TestUtils.VerifyCounts(stringFixture, 1, 0, 0, 0); } @@ -45,10 +46,10 @@ public void TestDoCheckNullWrong() MakeStringFixture(); stringFixture.Field = "some value"; TestUtils.DoCheck(stringFixture, TestUtils.CreateCellRange("field"), cell); - Assert.AreEqual("some value", stringFixture.Field); + ClassicAssert.AreEqual("some value", stringFixture.Field); AssertCellFails(cell); - Assert.IsTrue(cell.Body.IndexOf("null") > -1); - Assert.IsTrue(cell.Body.IndexOf("some value") > -1); + ClassicAssert.IsTrue(cell.Body.IndexOf("null") > -1); + ClassicAssert.IsTrue(cell.Body.IndexOf("some value") > -1); TestUtils.VerifyCounts(stringFixture, 0, 1, 0, 0); } } diff --git a/source/fitTest/NUnit/ParseBlankTest.cs b/source/fitTest/NUnit/ParseBlankTest.cs index db21a32f..c438d456 100644 --- a/source/fitTest/NUnit/ParseBlankTest.cs +++ b/source/fitTest/NUnit/ParseBlankTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2011 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2011 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -7,6 +7,7 @@ using fitSharp.Machine.Model; using fitSharp.Samples; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -23,9 +24,9 @@ public void SetUp() [Test] public void MatchesBlankString() { - Assert.IsTrue(IsMatch(new ParseBlank(), "blank")); - Assert.IsTrue(IsMatch(new ParseBlank(), "\r\n\t blank \r\n\t")); - Assert.IsFalse(IsMatch(new ParseBlank(), "is blank")); + ClassicAssert.IsTrue(IsMatch(new ParseBlank(), "blank")); + ClassicAssert.IsTrue(IsMatch(new ParseBlank(), "\r\n\t blank \r\n\t")); + ClassicAssert.IsFalse(IsMatch(new ParseBlank(), "is blank")); } [Test] @@ -33,7 +34,7 @@ public void TestDoInputBlank() { MakeStringFixture(); TestUtils.DoInput(stringFixture, TestUtils.CreateCellRange("Field"), cell); - Assert.AreEqual("", stringFixture.Field); + ClassicAssert.AreEqual("", stringFixture.Field); TestUtils.VerifyCounts(stringFixture, 0, 0, 0, 0); } @@ -42,7 +43,7 @@ public void TestDoCheckBlankRight() { MakeStringFixture(); stringFixture.Field = ""; TestUtils.DoCheck(stringFixture, TestUtils.CreateCellRange("Field"), cell); - Assert.AreEqual("", stringFixture.Field); + ClassicAssert.AreEqual("", stringFixture.Field); AssertCellPasses(cell); AssertValueInBody(cell, "blank"); TestUtils.VerifyCounts(stringFixture, 1, 0, 0, 0); @@ -52,8 +53,8 @@ public void TestDoCheckBlankRight() { public void TestDoEvaluateBlankRight() { MakeStringFixture(); stringFixture.Field = ""; - Assert.IsTrue(service.Compare(new TypedValue(string.Empty), cell)); - Assert.AreEqual("", stringFixture.Field); + ClassicAssert.IsTrue(service.Compare(new TypedValue(string.Empty), cell)); + ClassicAssert.AreEqual("", stringFixture.Field); AssertValueInBody(cell, "blank"); TestUtils.VerifyCounts(stringFixture, 0, 0, 0, 0); } @@ -64,7 +65,7 @@ public void TestDoCheckBlankWrongValue() MakeStringFixture(); stringFixture.Field = "some value"; TestUtils.DoCheck(stringFixture, TestUtils.CreateCellRange("Field"), cell); - Assert.AreEqual("some value", stringFixture.Field); + ClassicAssert.AreEqual("some value", stringFixture.Field); AssertCellFails(cell); AssertValuesInBody(cell, new[] {"blank", "some value"}); TestUtils.VerifyCounts(stringFixture, 0, 1, 0, 0); @@ -76,7 +77,7 @@ public void TestDoCheckBlankNullValue() MakeStringFixture(); stringFixture.Field = null; TestUtils.DoCheck(stringFixture, TestUtils.CreateCellRange("Field"), cell); - Assert.AreEqual(null, stringFixture.Field); + ClassicAssert.AreEqual(null, stringFixture.Field); AssertCellFails(cell); AssertValuesInBody(cell, new[] {"blank", "null"}); TestUtils.VerifyCounts(stringFixture, 0, 1, 0, 0); @@ -88,7 +89,7 @@ public void TestDoCheckBlankWrongTypeRightValue() MakePersonFixture(); personFixture.Field = new Person("", ""); TestUtils.DoCheck(personFixture, TestUtils.CreateCellRange("Field"), cell); - Assert.AreEqual("", personFixture.Field.ToString()); + ClassicAssert.AreEqual("", personFixture.Field.ToString()); AssertCellPasses(cell); AssertValuesInBody(cell, new[] {"blank"}); TestUtils.VerifyCounts(personFixture, 1, 0, 0, 0); @@ -99,7 +100,7 @@ public void TestDoCheckBlankWrongTypeWrongValue() { MakePersonFixture(); personFixture.Field = new Person("john", "doe"); TestUtils.DoCheck(personFixture, TestUtils.CreateCellRange("Field"), cell); - Assert.AreEqual("john doe", personFixture.Field.ToString()); + ClassicAssert.AreEqual("john doe", personFixture.Field.ToString()); AssertCellFails(cell); AssertValuesInBody(cell, new[] {"blank", "john doe"}); TestUtils.VerifyCounts(personFixture, 0, 1, 0, 0); diff --git a/source/fitTest/NUnit/ParseBooleanTest.cs b/source/fitTest/NUnit/ParseBooleanTest.cs index 0e8e9e19..f9dc96e4 100644 --- a/source/fitTest/NUnit/ParseBooleanTest.cs +++ b/source/fitTest/NUnit/ParseBooleanTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2017 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2017 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -9,6 +9,7 @@ using fitSharp.Machine.Model; using fitSharp.Samples.Fit; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] public class ParseBooleanTest { @@ -31,15 +32,15 @@ public void ParseValidStrings() { "false", "FALSE", "fAlSe", "FaLsE", "\n\tfalse\n" }; foreach (string validString in validTrueStrings) { - Assert.IsTrue(Parse(validString), "Parsing '" + validString + "'"); + ClassicAssert.IsTrue(Parse(validString), "Parsing '" + validString + "'"); } foreach (string validString in validFalseStrings) { - Assert.IsFalse(Parse(validString), "Parsing '" + validString + "'"); + ClassicAssert.IsFalse(Parse(validString), "Parsing '" + validString + "'"); } } [Test] public void ParseInvalidString() { - Assert.Throws(() => Parse("garbage")); + ClassicAssert.Throws(() => Parse("garbage")); } private bool Parse(string validString) { diff --git a/source/fitTest/NUnit/ParseInterpreterTest.cs b/source/fitTest/NUnit/ParseInterpreterTest.cs index bc0e65c6..86636ccf 100644 --- a/source/fitTest/NUnit/ParseInterpreterTest.cs +++ b/source/fitTest/NUnit/ParseInterpreterTest.cs @@ -9,6 +9,7 @@ using fitSharp.Fit.Operators; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] public class ParseInterpreterTest{ @@ -21,13 +22,13 @@ [Test] public void FixtureIsCreated() { [Test] public void DomainClassIsWrapped() { var result = Parse("
sample domain
"); var wrapper = VerifyResult(result); - Assert.IsNotNull(wrapper.SystemUnderTest as SampleDomain); + ClassicAssert.IsNotNull(wrapper.SystemUnderTest as SampleDomain); } [Test] public void FixtureWithSUTIsCreated() { var result = Parse("
sample do
", new TypedValue("target")); var sampleDo = VerifyResult(result); - Assert.AreEqual("target", sampleDo.SystemUnderTest.ToString()); + ClassicAssert.AreEqual("target", sampleDo.SystemUnderTest.ToString()); } TypedValue Parse(string inputTables) { @@ -45,7 +46,7 @@ TypedValue Parse(string inputTables, TypedValue target) { static T VerifyResult(TypedValue result) where T: class { var anObject = result.Value as T; - Assert.IsNotNull(anObject); + ClassicAssert.IsNotNull(anObject); return anObject; } diff --git a/source/fitTest/NUnit/ParseTest.cs b/source/fitTest/NUnit/ParseTest.cs index 8dadb2ca..b543f1f3 100644 --- a/source/fitTest/NUnit/ParseTest.cs +++ b/source/fitTest/NUnit/ParseTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2016 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2016 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -7,6 +7,7 @@ using fitSharp.Machine.Model; using fitSharp.Parser; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -16,27 +17,27 @@ public class ParseTest [Test] public void UnEscapeShouldRemoveHtmlEscapes() { - Assert.AreEqual("ab & b>c &&", new HtmlString("a>b & b>c &&").ToPlainText()); - Assert.AreEqual("&&", new HtmlString("&amp;&amp;").ToPlainText()); - Assert.AreEqual("a>b & b>c &&", new HtmlString("a>b & b>c &&").ToPlainText()); + ClassicAssert.AreEqual("ab & b>c &&", new HtmlString("a>b & b>c &&").ToPlainText()); + ClassicAssert.AreEqual("&&", new HtmlString("&amp;&amp;").ToPlainText()); + ClassicAssert.AreEqual("a>b & b>c &&", new HtmlString("a>b & b>c &&").ToPlainText()); } [Test] public void UnFormatShouldRemoveHtmlFormattingCodeIfPresent() { - Assert.AreEqual("ab",new HtmlString("ab").ToPlainText()); - Assert.AreEqual("ab",new HtmlString("ab").ToPlainText()); - Assert.AreEqual("aab").ToPlainText()); + ClassicAssert.AreEqual("ab",new HtmlString("ab").ToPlainText()); + ClassicAssert.AreEqual("a
body
"); - Assert.AreEqual("", p.Leader); - Assert.AreEqual("", p.Tag); - Assert.AreEqual("", p.Trailer); + ClassicAssert.AreEqual("", p.Leader); + ClassicAssert.AreEqual("
", p.Tag); + ClassicAssert.AreEqual("", p.Trailer); } static Parse SimpleTableParse @@ -48,38 +49,38 @@ static Parse SimpleTableParse public void BodyShouldReturnNullForTables() { Parse parse = SimpleTableParse; - Assert.IsTrue(string.IsNullOrEmpty(parse.Body)); + ClassicAssert.IsTrue(string.IsNullOrEmpty(parse.Body)); } [Test] public void BodyShouldReturnNullForRows() { Parse parse = SimpleTableParse; - Assert.IsTrue(string.IsNullOrEmpty(parse.Parts.Body)); + ClassicAssert.IsTrue(string.IsNullOrEmpty(parse.Parts.Body)); } [Test] public void BodyShouldReturnTextForCells() { Parse parse = SimpleTableParse; - Assert.AreEqual("body", parse.Parts.Parts.Body); + ClassicAssert.AreEqual("body", parse.Parts.Parts.Body); } [Test] public void PartsShouldReturnCellsWhenTheParseRepresentsARow() { Parse row = Parse.ParseFrom("
onetwothree
").Parts; - Assert.AreEqual("one", row.Parts.Body); - Assert.AreEqual("two", row.Parts.More.Body); - Assert.AreEqual("three", row.Parts.More.More.Body); + ClassicAssert.AreEqual("one", row.Parts.Body); + ClassicAssert.AreEqual("two", row.Parts.More.Body); + ClassicAssert.AreEqual("three", row.Parts.More.More.Body); } [Test] public void PartsShouldReturnRowsWhenTheParseRepresentsATable() { var table = Parse.ParseFrom("
row one
row two
"); - Assert.AreEqual("row one", table.Parts.Parts.Body); - Assert.AreEqual("row two", table.Parts.More.Parts.Body); + ClassicAssert.AreEqual("row one", table.Parts.Parts.Body); + ClassicAssert.AreEqual("row two", table.Parts.More.Parts.Body); } [Test] @@ -96,19 +97,19 @@ public void TestIndexingPage()
trailer"); - Assert.AreEqual("one", p.At(0,0,0).Body); - Assert.AreEqual("two", p.At(0,0,1).Body); - Assert.AreEqual("three", p.At(0,0,2).Body); - Assert.AreEqual("three", p.At(0,0,3).Body); - Assert.AreEqual("three", p.At(0,0,4).Body); - Assert.AreEqual("four", p.At(0,1,0).Body); - Assert.AreEqual("four", p.At(0,1,1).Body); - Assert.AreEqual("four", p.At(0,2,0).Body); - Assert.AreEqual(1, p.Size); - Assert.AreEqual(2, p.Parts.Size); - Assert.AreEqual(3, p.Parts.Parts.Size); - Assert.AreEqual("one", p.Leaf.Body); - Assert.AreEqual("four", p.Parts.Last.Leaf.Body); + ClassicAssert.AreEqual("one", p.At(0,0,0).Body); + ClassicAssert.AreEqual("two", p.At(0,0,1).Body); + ClassicAssert.AreEqual("three", p.At(0,0,2).Body); + ClassicAssert.AreEqual("three", p.At(0,0,3).Body); + ClassicAssert.AreEqual("three", p.At(0,0,4).Body); + ClassicAssert.AreEqual("four", p.At(0,1,0).Body); + ClassicAssert.AreEqual("four", p.At(0,1,1).Body); + ClassicAssert.AreEqual("four", p.At(0,2,0).Body); + ClassicAssert.AreEqual(1, p.Size); + ClassicAssert.AreEqual(2, p.Parts.Size); + ClassicAssert.AreEqual(3, p.Parts.Parts.Size); + ClassicAssert.AreEqual("one", p.Leaf.Body); + ClassicAssert.AreEqual("four", p.Parts.Last.Leaf.Body); } [Test] @@ -117,34 +118,34 @@ public void TestParseException() try { Parse.ParseFrom("leader
onetwothree
four
trailer"); - Assert.Fail("expected Exception not thrown"); + ClassicAssert.Fail("expected Exception not thrown"); } catch (ApplicationException e) { - Assert.AreEqual("Can't find tag: td", e.Message); + ClassicAssert.AreEqual("Can't find tag: td", e.Message); } } [Test] public void TestText() { Parse p = Parse.ParseFrom("
a<b
").Parts.Parts; - Assert.AreEqual("a<b", p.Body); - Assert.AreEqual("a
\ta>b & b>c && 
").Parts.Parts; - Assert.AreEqual("\ta>b & b>c && ", p.Text); + ClassicAssert.AreEqual("\ta>b & b>c && ", p.Text); p = Parse.ParseFrom("
\ta>b & b>c & 
").Parts.Parts; - Assert.AreEqual("\ta>b & b>c & ", p.Text); + ClassicAssert.AreEqual("\ta>b & b>c & ", p.Text); p = Parse.ParseFrom("

GroupTestFixture

").Parts.Parts; - Assert.AreEqual("GroupTestFixture",p.Text); + ClassicAssert.AreEqual("GroupTestFixture",p.Text); } [Test] public void TestContent() { Parse p = Parse.ParseFrom("
\r\n\t a \r\n\t
").Parts.Parts; - Assert.AreEqual("a", p.Content); + ClassicAssert.AreEqual("a", p.Content); p = Parse.ParseFrom("
\r\n\t a \r\n\tb
").Parts.Parts; - Assert.AreEqual("a \r\n\tb", p.Content); + ClassicAssert.AreEqual("a \r\n\tb", p.Content); } [Test] public void CopyFromLeaf() { @@ -154,7 +155,7 @@ [Test] public void CopyFromLeaf() { } static void AssertCopyFromResult(Tree source, string expected) { - Assert.AreEqual(expected, Parse.CopyFrom(source).ToString()); + ClassicAssert.AreEqual(expected, Parse.CopyFrom(source).ToString()); } static TreeList MakeRootNode() { @@ -189,11 +190,11 @@ [Test] public void CopyFromWithBranches() { [Test] public void BranchesAreAdded() { var parse = new Parse("tr", string.Empty, null, null); parse.Add(new Parse("td", "first", null, null)); - Assert.AreEqual("first", parse.Parts.Body); + ClassicAssert.AreEqual("first", parse.Parts.Body); parse.Add(new Parse("td", "second", null, null)); - Assert.AreEqual("second", parse.Parts.More.Body); + ClassicAssert.AreEqual("second", parse.Parts.More.Body); parse.Add(new Parse("td", "third", null, null)); - Assert.AreEqual("third", parse.Parts.Last.Body); + ClassicAssert.AreEqual("third", parse.Parts.Last.Body); } } } diff --git a/source/fitTest/NUnit/ParseTreeTest.cs b/source/fitTest/NUnit/ParseTreeTest.cs index 1e34f8f5..024c0ac5 100644 --- a/source/fitTest/NUnit/ParseTreeTest.cs +++ b/source/fitTest/NUnit/ParseTreeTest.cs @@ -6,6 +6,7 @@ using fit.Test.Double; using fitlibrary.tree; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] public class ParseTreeTest { @@ -13,12 +14,12 @@ [TestFixture] public class ParseTreeTest { [Test] public void MatchesTreeObject() { Parse table = Parse.ParseFrom("
  • a
  • b
"); var tree = new ParseTree(table.Parts.Parts.Parts); - Assert.IsTrue(tree.Equals(new SampleTree(string.Empty, "a", "b"))); + ClassicAssert.IsTrue(tree.Equals(new SampleTree(string.Empty, "a", "b"))); } [Test] public void MatchesEmptyTreeObject() { var tree = new ParseTree(new Parse("ul", string.Empty, null, null)); - Assert.IsTrue(tree.Equals(new SampleTree(string.Empty))); + ClassicAssert.IsTrue(tree.Equals(new SampleTree(string.Empty))); } } diff --git a/source/fitTest/NUnit/PathParserTest.cs b/source/fitTest/NUnit/PathParserTest.cs index 03c9a169..a9a97a50 100644 --- a/source/fitTest/NUnit/PathParserTest.cs +++ b/source/fitTest/NUnit/PathParserTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2009 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2009 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -8,6 +8,7 @@ using System.Linq; using fitnesse.fitserver; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -17,7 +18,7 @@ public class PathParserTest public void TestEmptyString() { PathParser parser = new PathParser(""); - Assert.AreEqual(0, parser.AssemblyPaths.Count()); + ClassicAssert.AreEqual(0, parser.AssemblyPaths.Count()); } [Test] @@ -83,9 +84,9 @@ public void TestOneConfigFileAndOneAssemblyFile() private void verifyAssemblyPaths(string[] expected, IEnumerable list2) { IList list1 = new ArrayList(expected); - Assert.AreEqual(list1.Count, list2.Count()); + ClassicAssert.AreEqual(list1.Count, list2.Count()); foreach (string obj in list1) - Assert.IsTrue(list2.Contains(obj)); + ClassicAssert.IsTrue(list2.Contains(obj)); } diff --git a/source/fitTest/NUnit/ProtocolTest.cs b/source/fitTest/NUnit/ProtocolTest.cs index 091cc4d9..fcd6361a 100644 --- a/source/fitTest/NUnit/ProtocolTest.cs +++ b/source/fitTest/NUnit/ProtocolTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2009 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2009 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -6,6 +6,7 @@ using fit.Runner; using fitnesse.fitserver; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -15,9 +16,9 @@ public class ProtocolTest [Test] public void WriteIntegerToIntegerString() { - Assert.AreEqual("0000000009", Protocol.FormatInteger(9)); - Assert.AreEqual("0000000123", Protocol.FormatInteger(123)); - Assert.AreEqual("0000004444", Protocol.FormatInteger(4444)); + ClassicAssert.AreEqual("0000000009", Protocol.FormatInteger(9)); + ClassicAssert.AreEqual("0000000123", Protocol.FormatInteger(123)); + ClassicAssert.AreEqual("0000004444", Protocol.FormatInteger(4444)); } [Test] @@ -28,20 +29,20 @@ public void ToTransmissionDocument() string Actual = Protocol.FormatDocument(Content); - Assert.AreEqual(Expected, Actual); + ClassicAssert.AreEqual(Expected, Actual); } [Test] public void TestMakeHttpRequest() { string request = Protocol.FormatRequest("SomePageName", false, null); - Assert.AreEqual("GET /SomePageName?responder=fitClient HTTP/1.1\r\n\r\n", request); + ClassicAssert.AreEqual("GET /SomePageName?responder=fitClient HTTP/1.1\r\n\r\n", request); request = Protocol.FormatRequest("SomePageName", true, null); - Assert.AreEqual("GET /SomePageName?responder=fitClient&includePaths=yes HTTP/1.1\r\n\r\n", request); + ClassicAssert.AreEqual("GET /SomePageName?responder=fitClient&includePaths=yes HTTP/1.1\r\n\r\n", request); request = Protocol.FormatRequest("SomePageName", false, "myfilter"); - Assert.AreEqual("GET /SomePageName?responder=fitClient&suiteFilter=myfilter HTTP/1.1\r\n\r\n", request); + ClassicAssert.AreEqual("GET /SomePageName?responder=fitClient&suiteFilter=myfilter HTTP/1.1\r\n\r\n", request); } } diff --git a/source/fitTest/NUnit/RowFixtureTest.cs b/source/fitTest/NUnit/RowFixtureTest.cs index 3b837194..2af59399 100644 --- a/source/fitTest/NUnit/RowFixtureTest.cs +++ b/source/fitTest/NUnit/RowFixtureTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2018 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2018 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -13,6 +13,7 @@ using fitSharp.Machine.Model; using fitSharp.Samples; using NUnit.Framework; +using NUnit.Framework.Legacy; using TestStatus=fitSharp.Fit.Model.TestStatus; namespace fit.Test.NUnit { @@ -115,9 +116,9 @@ public void TestSurplus() }; RunTest(new BusinessObjectRowFixture(), parse); - Assert.IsTrue(parse.ToString().IndexOf("number1", StringComparison.Ordinal) > 0); - Assert.IsTrue(parse.ToString().IndexOf("number2", StringComparison.Ordinal) > 0); - Assert.IsTrue(parse.ToString().IndexOf("number3", StringComparison.Ordinal) > 0); + ClassicAssert.IsTrue(parse.ToString().IndexOf("number1", StringComparison.Ordinal) > 0); + ClassicAssert.IsTrue(parse.ToString().IndexOf("number2", StringComparison.Ordinal) > 0); + ClassicAssert.IsTrue(parse.ToString().IndexOf("number3", StringComparison.Ordinal) > 0); TestUtils.CheckCounts(resultCounts, 1, 2, 0, 0); } @@ -141,9 +142,9 @@ public void TestMissing() }; RunTest(new BusinessObjectRowFixture(), parse); - Assert.IsTrue(parse.ToString().IndexOf("number1", StringComparison.Ordinal) > 0); - Assert.IsTrue(parse.ToString().IndexOf("number2", StringComparison.Ordinal) > 0); - Assert.IsTrue(parse.ToString().IndexOf("number3", StringComparison.Ordinal) > 0); + ClassicAssert.IsTrue(parse.ToString().IndexOf("number1", StringComparison.Ordinal) > 0); + ClassicAssert.IsTrue(parse.ToString().IndexOf("number2", StringComparison.Ordinal) > 0); + ClassicAssert.IsTrue(parse.ToString().IndexOf("number3", StringComparison.Ordinal) > 0); TestUtils.CheckCounts(resultCounts, 1, 2, 0, 0); } @@ -161,8 +162,8 @@ public void TestStartsWithHandlerInSecondColumn() PeopleLoaderFixture.people.Add(new Person("Nigel", "Tufnel")); var tables = builder.Parse; RunTest(new PeopleRowFixture(), tables); - Assert.IsTrue(tables.ToString().IndexOf("Tuf..", StringComparison.Ordinal) > -1); - Assert.IsFalse(tables.ToString().IndexOf("Tufnel", StringComparison.Ordinal) > -1); + ClassicAssert.IsTrue(tables.ToString().IndexOf("Tuf..", StringComparison.Ordinal) > -1); + ClassicAssert.IsFalse(tables.ToString().IndexOf("Tufnel", StringComparison.Ordinal) > -1); TestUtils.CheckCounts(resultCounts, 2, 0, 0, 0); } @@ -406,7 +407,7 @@ public void TestCorrectFormatForMissing() var testTable = new TestBuilder(inspectorFixtureHtml).Parse; RunTest(new PeopleLoaderFixture(), new TestBuilder(loaderFixtureHtml).Parse); RunTest(new PeopleRowFixture(), testTable); - Assert.AreEqual( + ClassicAssert.AreEqual( "
7 missingnullestJonesey
2Philblank
1 surplusnullJones
do
do
"); - Assert.AreEqual("
do
do
", resultTables); + ClassicAssert.AreEqual("
do
do
", resultTables); } [Test] public void RegularTestUseCopyOfMemory() { var service = new Service.Service(); RunMemoryTest(service, "Regular"); - Assert.IsFalse(service.Memory.HasItem()); + ClassicAssert.IsFalse(service.Memory.HasItem()); } void RunMemoryTest(Service.Service service, string leader) { @@ -44,15 +45,15 @@ void RunMemoryTest(Service.Service service, string leader) { [Test] public void SuiteSetUpUpdatesMemory() { var service = new Service.Service(); RunMemoryTest(service, "SuiteSetUp"); - Assert.IsTrue(service.Memory.HasItem()); + ClassicAssert.IsTrue(service.Memory.HasItem()); } [Test] public void ParseExceptionIsRecorded() { var service = new Service.Service(); const string tables = "garbage
"; RunTest(service, tables); - Assert.IsTrue(resultTables.Contains("class=\"error\""), resultTables); - Assert.IsTrue(resultTables.Contains("Unable to parse input. Input ignored."), resultTables); + ClassicAssert.IsTrue(resultTables.Contains("class=\"error\""), resultTables); + ClassicAssert.IsTrue(resultTables.Contains("Unable to parse input. Input ignored."), resultTables); } private void RunTest(CellProcessor service, string tables) { @@ -62,7 +63,7 @@ private void RunTest(CellProcessor service, string tables) { port.AddInput(Protocol.FormatInteger(0)); var server = new SocketServer(new FitSocket(new MessageChannel(port), new NullReporter()), service, new NullReporter(), false); server.ProcessTestDocuments(new StoryTestStringWriter().ForTables(s => resultTables += s)); - Assert.IsFalse(port.IsOpen); + ClassicAssert.IsFalse(port.IsOpen); } } diff --git a/source/fitTest/NUnit/StartsWithHandlerTest.cs b/source/fitTest/NUnit/StartsWithHandlerTest.cs index 0ceb7d8a..fff8aad5 100644 --- a/source/fitTest/NUnit/StartsWithHandlerTest.cs +++ b/source/fitTest/NUnit/StartsWithHandlerTest.cs @@ -1,10 +1,11 @@ -// Copyright © 2009 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2009 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. using fitSharp.Fit.Operators; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -15,9 +16,9 @@ public class StartsWithHandlerTest: CellOperatorTest [Test] public void TestMatches() { - Assert.IsTrue(IsMatch("abc..")); - Assert.IsFalse(IsMatch("..abc")); - Assert.IsFalse(IsMatch("..abc..")); + ClassicAssert.IsTrue(IsMatch("abc..")); + ClassicAssert.IsFalse(IsMatch("..abc")); + ClassicAssert.IsFalse(IsMatch("..abc..")); } private static bool IsMatch(string input) { diff --git a/source/fitTest/NUnit/SubstringHandlerTest.cs b/source/fitTest/NUnit/SubstringHandlerTest.cs index 079e1ab3..379db192 100644 --- a/source/fitTest/NUnit/SubstringHandlerTest.cs +++ b/source/fitTest/NUnit/SubstringHandlerTest.cs @@ -1,10 +1,11 @@ -// Copyright © 2009 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2009 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. using fitSharp.Fit.Operators; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] @@ -15,9 +16,9 @@ public class SubstringHandlerTest: CellOperatorTest [Test] public void TestMatch() { - Assert.IsTrue(IsMatch("..text..")); - Assert.IsFalse(IsMatch("text..")); - Assert.IsFalse(IsMatch("..text")); + ClassicAssert.IsTrue(IsMatch("..text..")); + ClassicAssert.IsFalse(IsMatch("text..")); + ClassicAssert.IsFalse(IsMatch("..text")); } private static bool IsMatch(string input) { diff --git a/source/fitTest/NUnit/SymbolHandlerTest.cs b/source/fitTest/NUnit/SymbolHandlerTest.cs index f4f54435..d9050e93 100644 --- a/source/fitTest/NUnit/SymbolHandlerTest.cs +++ b/source/fitTest/NUnit/SymbolHandlerTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2011 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2011 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -9,18 +9,19 @@ using fitSharp.Machine.Model; using fitSharp.Samples; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace fit.Test.NUnit { [TestFixture] public class SymbolHandlerTest: CellOperatorTest { [Test] public void TestRegisterAndGet() { - Assert.IsFalse(IsMatch(new CheckSymbolSave(), "x<>xyz")); - Assert.IsFalse(IsMatch(new CheckSymbolSave(), "x>>yz")); + ClassicAssert.IsFalse(IsMatch(new CheckSymbolSave(), "x<>xyz")); + ClassicAssert.IsFalse(IsMatch(new CheckSymbolSave(), "x>>yz")); // Make sure we recognize symbols even in formatted content - Assert.IsTrue(IsMatch(new CheckSymbolSave(), "\n >>xyz\n")); + ClassicAssert.IsTrue(IsMatch(new CheckSymbolSave(), "\n >>xyz\n")); } [Test] public void TestWhitespaceEnclosedSave() { @@ -29,7 +30,7 @@ [Test] public void TestWhitespaceEnclosedSave() { stringFixture.Field = "abc"; TestUtils.DoCheck(stringFixture, TestUtils.CreateCellRange("Field"), cell); - Assert.AreEqual("abc", LoadSymbol("xyz")); + ClassicAssert.AreEqual("abc", LoadSymbol("xyz")); } [Test] @@ -38,7 +39,7 @@ public void TestSaveString() { MakeStringFixture(); stringFixture.Field = "abc"; TestUtils.DoCheck(stringFixture, TestUtils.CreateCellRange("Field"), cell); - Assert.AreEqual("abc", LoadSymbol("xyz")); + ClassicAssert.AreEqual("abc", LoadSymbol("xyz")); TestUtils.VerifyCounts(stringFixture, 0, 0, 0, 0); } @@ -49,7 +50,7 @@ public void CellContentWhenSaving() MakeStringFixture(); stringFixture.Field = "abc"; TestUtils.DoCheck(stringFixture, TestUtils.CreateCellRange("Field"), cell); - Assert.AreEqual(">>xyz abc", cell.Body); + ClassicAssert.AreEqual(">>xyz abc", cell.Body); } [Test] @@ -60,7 +61,7 @@ public void CellContentWhenRecalling_Right() StoreSymbol("def", "ghi"); stringFixture.Field = "ghi"; TestUtils.DoCheck(stringFixture, TestUtils.CreateCellRange("Field"), cell); - Assert.AreEqual("< ghi", cell.Body); + ClassicAssert.AreEqual("< ghi", cell.Body); TestUtils.VerifyCounts(stringFixture, 1, 0, 0, 0); } @@ -72,7 +73,7 @@ public void CellContentWhenRecalling_Wrong() StoreSymbol("def", "ghi"); stringFixture.Field = "xyz"; TestUtils.DoCheck(stringFixture, TestUtils.CreateCellRange("Field"), cell); - Assert.AreEqual("< ghi expected
xyz actual
At 0 expected g was x", cell.Body); + ClassicAssert.AreEqual("< ghi expected
xyz actual
At 0 expected g was x", cell.Body); TestUtils.VerifyCounts(stringFixture, 0, 1, 0, 0); } @@ -84,7 +85,7 @@ public void CellContentWhenRecalling_Input() StoreSymbol("def", "ghi"); stringFixture.Field = "xyz"; TestUtils.DoInput(stringFixture, TestUtils.CreateCellRange("Field"), cell); - Assert.AreEqual("< ghi", cell.Body); + ClassicAssert.AreEqual("< ghi", cell.Body); TestUtils.VerifyCounts(stringFixture, 0, 0, 0, 0); } @@ -96,7 +97,7 @@ public void CellContentWhenRecalling_Evaluate() StoreSymbol("def", "ghi"); stringFixture.Field = "xyz"; service.Compare(new TypedValue("xyz"), cell); - Assert.AreEqual("< ghi", cell.Body); + ClassicAssert.AreEqual("< ghi", cell.Body); TestUtils.VerifyCounts(stringFixture, 0, 0, 0, 0); } @@ -106,7 +107,7 @@ public void TestEvaluateRecallStringPass() { MakeStringFixture(); StoreSymbol("def", "ghi"); stringFixture.Field = "ghi"; - Assert.IsTrue(service.Compare(new TypedValue("ghi"), cell)); + ClassicAssert.IsTrue(service.Compare(new TypedValue("ghi"), cell)); TestUtils.VerifyCounts(stringFixture, 0, 0, 0, 0); } @@ -116,7 +117,7 @@ public void TestEvaluateRecallStringFail() { MakeStringFixture(); StoreSymbol("def", "ghi"); stringFixture.Field = "not ghi"; - Assert.IsFalse(service.Compare(new TypedValue("not ghi"), cell)); + ClassicAssert.IsFalse(service.Compare(new TypedValue("not ghi"), cell)); TestUtils.VerifyCounts(stringFixture, 0, 0, 0, 0); } @@ -126,7 +127,7 @@ public void TestEvaluateRecallStringFailNull() { MakeStringFixture(); StoreSymbol("def", "ghi"); stringFixture.Field = null; - Assert.IsFalse(service.Compare(new TypedValue(null, typeof(string)), cell)); + ClassicAssert.IsFalse(service.Compare(new TypedValue(null, typeof(string)), cell)); TestUtils.VerifyCounts(stringFixture, 0, 0, 0, 0); } @@ -180,9 +181,9 @@ public void TestCheckRecallValueFailPerson() [Test] public void SymbolNamesWithWhitespace() { StoreSymbol("\r\n\tfoo\r\n", "bar"); - Assert.AreEqual("bar", LoadSymbol("foo")); - Assert.AreEqual("bar", LoadSymbol("\r\n\tfoo\r\n")); - Assert.AreEqual("bar", LoadSymbol("foo\r\n")); + ClassicAssert.AreEqual("bar", LoadSymbol("foo")); + ClassicAssert.AreEqual("bar", LoadSymbol("\r\n\tfoo\r\n")); + ClassicAssert.AreEqual("bar", LoadSymbol("foo\r\n")); } private object LoadSymbol(string symbolName) { diff --git a/source/fitTest/NUnit/TableFixtureTest.cs b/source/fitTest/NUnit/TableFixtureTest.cs index 08251a07..4942fc08 100644 --- a/source/fitTest/NUnit/TableFixtureTest.cs +++ b/source/fitTest/NUnit/TableFixtureTest.cs @@ -1,4 +1,4 @@ -// Copyright © 2010 Syterra Software Inc. Includes work by Object Mentor, Inc., © 2002 Cunningham & Cunningham, Inc. +// Copyright � 2010 Syterra Software Inc. Includes work by Object Mentor, Inc., � 2002 Cunningham & Cunningham, Inc. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -7,6 +7,7 @@ using fitSharp.Fit.Model; using fitSharp.Machine.Model; using NUnit.Framework; +using NUnit.Framework.Legacy; using TestStatus=fitSharp.Fit.Model.TestStatus; namespace fit.Test.NUnit @@ -42,60 +43,60 @@ public void TearDown() [Test] public void TestNumRows() { - Assert.AreEqual(1, ExampleTableFixture.numRows); + ClassicAssert.AreEqual(1, ExampleTableFixture.numRows); } [Test] public void TestDoStaticTable() { - Assert.AreEqual(1, ExampleTableFixture.timesDoStaticTableCalled); + ClassicAssert.AreEqual(1, ExampleTableFixture.timesDoStaticTableCalled); } [Test] public void TestGetCell() { - Assert.AreEqual("0,0", ExampleTableFixture.ZeroZero); + ClassicAssert.AreEqual("0,0", ExampleTableFixture.ZeroZero); } [Test] public void TestGetText() { - Assert.AreEqual("0,1", ExampleTableFixture.ZeroOne); + ClassicAssert.AreEqual("0,1", ExampleTableFixture.ZeroOne); } [Test] public void TestGetInt() { - Assert.AreEqual(37, ExampleTableFixture.resultOfGetInt); + ClassicAssert.AreEqual(37, ExampleTableFixture.resultOfGetInt); } [Test] public void TestRight() { - Assert.AreEqual(1, resultCounts.GetCount(TestStatus.Right)); - Assert.AreEqual(TestStatus.Right, table.At(0,1,0).GetAttribute(CellAttribute.Status)); + ClassicAssert.AreEqual(1, resultCounts.GetCount(TestStatus.Right)); + ClassicAssert.AreEqual(TestStatus.Right, table.At(0,1,0).GetAttribute(CellAttribute.Status)); } [Test] public void TestWrong() { - Assert.AreEqual(2, resultCounts.GetCount(TestStatus.Wrong)); - Assert.AreEqual(TestStatus.Wrong, table.At(0,1,1).GetAttribute(CellAttribute.Status)); - Assert.AreEqual(TestStatus.Wrong, table.At(0,1,2).GetAttribute(CellAttribute.Status)); - Assert.IsTrue(table.At(0,1,2).Body.IndexOf("actual") > 0); + ClassicAssert.AreEqual(2, resultCounts.GetCount(TestStatus.Wrong)); + ClassicAssert.AreEqual(TestStatus.Wrong, table.At(0,1,1).GetAttribute(CellAttribute.Status)); + ClassicAssert.AreEqual(TestStatus.Wrong, table.At(0,1,2).GetAttribute(CellAttribute.Status)); + ClassicAssert.IsTrue(table.At(0,1,2).Body.IndexOf("actual") > 0); } [Test] public void TestIgnore() { - Assert.AreEqual(1, resultCounts.GetCount(TestStatus.Ignore)); - Assert.AreEqual(TestStatus.Ignore, table.At(0,1,3).GetAttribute(CellAttribute.Status)); + ClassicAssert.AreEqual(1, resultCounts.GetCount(TestStatus.Ignore)); + ClassicAssert.AreEqual(TestStatus.Ignore, table.At(0,1,3).GetAttribute(CellAttribute.Status)); } [Test] public void TestBlank() { - Assert.IsTrue(ExampleTableFixture.blankCell); + ClassicAssert.IsTrue(ExampleTableFixture.blankCell); } } } diff --git a/source/fitTest/NUnit/TestUtils.cs b/source/fitTest/NUnit/TestUtils.cs index 47bbeaff..9dbb5607 100644 --- a/source/fitTest/NUnit/TestUtils.cs +++ b/source/fitTest/NUnit/TestUtils.cs @@ -11,6 +11,7 @@ using fitSharp.Machine.Model; using fitSharp.Samples; using NUnit.Framework; +using NUnit.Framework.Legacy; using TestStatus=fitSharp.Fit.Model.TestStatus; namespace fit.Test.NUnit { @@ -44,17 +45,17 @@ public static void DoCheck(Fixture fixture, Tree range, Parse cell) { } public static void CheckCounts(TestCounts counts, int right, int wrong, int ignore, int exception) { - Assert.AreEqual(right, counts.GetCount(TestStatus.Right)); - Assert.AreEqual(wrong, counts.GetCount(TestStatus.Wrong)); - Assert.AreEqual(ignore, counts.GetCount(TestStatus.Ignore)); - Assert.AreEqual(exception, counts.GetCount(TestStatus.Exception)); + ClassicAssert.AreEqual(right, counts.GetCount(TestStatus.Right)); + ClassicAssert.AreEqual(wrong, counts.GetCount(TestStatus.Wrong)); + ClassicAssert.AreEqual(ignore, counts.GetCount(TestStatus.Ignore)); + ClassicAssert.AreEqual(exception, counts.GetCount(TestStatus.Exception)); } public static void VerifyCounts(Fixture fixture, int right, int wrong, int ignores, int exceptions) { - Assert.AreEqual(right, fixture.TestStatus.Counts.GetCount(TestStatus.Right)); - Assert.AreEqual(wrong, fixture.TestStatus.Counts.GetCount(TestStatus.Wrong)); - Assert.AreEqual(ignores, fixture.TestStatus.Counts.GetCount(TestStatus.Ignore)); - Assert.AreEqual(exceptions, fixture.TestStatus.Counts.GetCount(TestStatus.Exception)); + ClassicAssert.AreEqual(right, fixture.TestStatus.Counts.GetCount(TestStatus.Right)); + ClassicAssert.AreEqual(wrong, fixture.TestStatus.Counts.GetCount(TestStatus.Wrong)); + ClassicAssert.AreEqual(ignores, fixture.TestStatus.Counts.GetCount(TestStatus.Ignore)); + ClassicAssert.AreEqual(exceptions, fixture.TestStatus.Counts.GetCount(TestStatus.Exception)); } } @@ -64,16 +65,16 @@ public class PersonTest [Test] public void TestConstructor() { var person = new Person("john", "doe"); - Assert.AreEqual("john doe", person.ToString()); + ClassicAssert.AreEqual("john doe", person.ToString()); } [Test] public void TestConstructorWithId() { var person = new Person(1, "jane", "roe"); - Assert.AreEqual("jane roe", person.ToString()); - Assert.AreEqual("jane", person.FirstName); - Assert.AreEqual("roe", person.LastName); - Assert.AreEqual(1, person.Id); + ClassicAssert.AreEqual("jane roe", person.ToString()); + ClassicAssert.AreEqual("jane", person.FirstName); + ClassicAssert.AreEqual("roe", person.LastName); + ClassicAssert.AreEqual(1, person.Id); } [Test] @@ -81,7 +82,7 @@ public void TestIsTalented() { var person = new Person("Scott", "Henderson"); person.SetTalented(true); - Assert.IsTrue(person.IsTalented); + ClassicAssert.IsTrue(person.IsTalented); } [Test] @@ -89,7 +90,7 @@ public void TestParse() { const string name = "joe schmoe"; Person person = Person.Parse(name); - Assert.AreEqual(name, person.ToString()); + ClassicAssert.AreEqual(name, person.ToString()); } [Test] @@ -97,7 +98,7 @@ public void TestEquals() { var original = new Person("Wes", "Montgomery"); var copy = new Person("Wes", "Montgomery"); - Assert.IsTrue(original.Equals(copy)); + ClassicAssert.IsTrue(original.Equals(copy)); } } } \ No newline at end of file diff --git a/source/fitTest/fitTest.csproj b/source/fitTest/fitTest.csproj index 8453d1a6..a4ae9d19 100644 --- a/source/fitTest/fitTest.csproj +++ b/source/fitTest/fitTest.csproj @@ -1,6 +1,6 @@  - net48;net6.0;net6.0-windows;net7.0;net7.0-windows;net8.0;net8.0-windows + net48;net8.0;net8.0-windows;net9.0;net9.0-windows fit.Test false false @@ -13,8 +13,8 @@ - - + + diff --git a/source/fitTest/fitTestL.csproj b/source/fitTest/fitTestL.csproj index c88bb70c..617e2e06 100644 --- a/source/fitTest/fitTestL.csproj +++ b/source/fitTest/fitTestL.csproj @@ -4,7 +4,7 @@ false false fitTest - net6.0 + net8.0