Skip to content

Commit

Permalink
Update NUnit dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
sqeezy committed Sep 23, 2024
1 parent cd983f1 commit cbbd8d3
Show file tree
Hide file tree
Showing 122 changed files with 1,009 additions and 892 deletions.
3 changes: 2 additions & 1 deletion source/StoryTest/StoryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using fitSharp.Machine.Application;
using fitSharp.Machine.Model;
using NUnit.Framework;
using NUnit.Framework.Legacy;

namespace fitSharp.StoryTest {
[TestFixture]
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions source/StoryTest/StoryTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
<PackageReference Include="NUnit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
</ItemGroup>

<ItemGroup>
Expand Down
42 changes: 21 additions & 21 deletions source/dbfitTest/DbConnectionPropertiesTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;

using NUnit.Framework.Legacy;

namespace dbfit.util
{
Expand All @@ -15,22 +15,22 @@ 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);
ClassicAssert.AreEqual("test1234", props.FullConnectionString);
ClassicAssert.IsNull(props.Username);
ClassicAssert.IsNull(props.Password);
ClassicAssert.IsNull(props.Service);
ClassicAssert.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);
ClassicAssert.AreEqual("test1234&Username=US&Password=PW", props.FullConnectionString);
ClassicAssert.IsNull(props.Username);
ClassicAssert.IsNull(props.Password);
ClassicAssert.IsNull(props.Service);
ClassicAssert.IsNull(props.DbName);
}
[Test]
public void TestWithSplitProperties()
Expand All @@ -40,11 +40,11 @@ public void TestWithSplitProperties()
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);
ClassicAssert.IsNull(props.FullConnectionString);
ClassicAssert.AreEqual("testuser",props.Username);
ClassicAssert.AreEqual("testpwd",props.Password);
ClassicAssert.AreEqual("testsvc",props.Service);
ClassicAssert.AreEqual("testdb",props.DbName);
}
[Test]
public void TestCommentsAndEmptyLines()
Expand All @@ -57,11 +57,11 @@ public void TestCommentsAndEmptyLines()
#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);
ClassicAssert.IsNull(props.FullConnectionString);
ClassicAssert.AreEqual("testuser", props.Username);
ClassicAssert.AreEqual("testpwd", props.Password);
ClassicAssert.AreEqual("testsvc", props.Service);
ClassicAssert.AreEqual("testdb", props.DbName);
}

}
Expand Down
33 changes: 17 additions & 16 deletions source/dbfitTest/ExecuteProcedureTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using fit.Service;
using Moq;
using NUnit.Framework;
using NUnit.Framework.Legacy;
using TestStatus=fitSharp.Fit.Model.TestStatus;

namespace dbfitTest {
Expand All @@ -36,26 +37,26 @@ public void SortAccessorsInRightOrder()
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);
ClassicAssert.AreEqual(1, resultingAccessors[0].Position);
ClassicAssert.AreEqual(3, resultingAccessors[1].Position);
ClassicAssert.AreEqual(5, resultingAccessors[2].Position);
ClassicAssert.AreEqual(7, resultingAccessors[3].Position);
}
[Test] public void ExecutesProcedureWithNoParameters() {
var command = new TestCommand();
RunTest(command, null, string.Empty);
Assert.AreEqual(1, command.ExecuteNonQueryCalls);
ClassicAssert.AreEqual(1, command.ExecuteNonQueryCalls);
}

[Test] public void ExecutesProcedureWithInputParameter() {
var command = new TestCommand {
NonQueryAction = (c => Assert.AreEqual("invalue", c.Parameters[0].Value))
NonQueryAction = (c => ClassicAssert.AreEqual("invalue", c.Parameters[0].Value))
};

RunTest(command, MakeParameters("inparm", ParameterDirection.Input),
"<tr><td>inparm</td></tr><tr><td>invalue</td></tr>");

Assert.AreEqual(1, command.ExecuteNonQueryCalls);
ClassicAssert.AreEqual(1, command.ExecuteNonQueryCalls);
}

[Test] public void ExecutesProcedureWithOutputParameter() {
Expand All @@ -66,23 +67,23 @@ [Test] public void ExecutesProcedureWithOutputParameter() {
RunTest(command, MakeParameters("outparm", ParameterDirection.Output),
"<tr><td>outparm?</td></tr><tr><td>outvalue</td></tr>");

Assert.AreEqual(1, command.ExecuteNonQueryCalls);
Assert.AreEqual(1, fixture.TestStatus.Counts.GetCount(TestStatus.Right));
ClassicAssert.AreEqual(1, command.ExecuteNonQueryCalls);
ClassicAssert.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);
ClassicAssert.AreEqual("invalue", c.Parameters[0].Value);
c.Parameters[0].Value = "outvalue";
})
};

RunTest(command, MakeParameters("ioparm", ParameterDirection.InputOutput),
"<tr><td>ioparm</td><td>ioparm?</td></tr><tr><td>invalue</td><td>outvalue</td></tr>");

Assert.AreEqual(1, command.ExecuteNonQueryCalls);
Assert.AreEqual(1, fixture.TestStatus.Counts.GetCount(TestStatus.Right));
ClassicAssert.AreEqual(1, command.ExecuteNonQueryCalls);
ClassicAssert.AreEqual(1, fixture.TestStatus.Counts.GetCount(TestStatus.Right));
}

[Test] public void MarksWrongIfNoExpectedException() {
Expand All @@ -92,8 +93,8 @@ [Test] public void MarksWrongIfNoExpectedException() {
RunTest(command, MakeParameters("inparm", ParameterDirection.Input),
"<tr><td>inparm</td></tr><tr><td>invalue</td></tr>");

Assert.AreEqual(1, command.ExecuteNonQueryCalls);
Assert.AreEqual(1, fixture.TestStatus.Counts.GetCount(TestStatus.Wrong));
ClassicAssert.AreEqual(1, command.ExecuteNonQueryCalls);
ClassicAssert.AreEqual(1, fixture.TestStatus.Counts.GetCount(TestStatus.Wrong));
}

[Test] public void MarksRightIfExpectedException() {
Expand All @@ -105,8 +106,8 @@ [Test] public void MarksRightIfExpectedException() {
RunTest(command, MakeParameters("inparm", ParameterDirection.Input),
"<tr><td>inparm</td></tr><tr><td>invalue</td></tr>");

Assert.AreEqual(1, command.ExecuteNonQueryCalls);
Assert.AreEqual(1, fixture.TestStatus.Counts.GetCount(TestStatus.Right));
ClassicAssert.AreEqual(1, command.ExecuteNonQueryCalls);
ClassicAssert.AreEqual(1, fixture.TestStatus.Counts.GetCount(TestStatus.Right));
}

private static Dictionary<string, DbParameterAccessor> MakeParameters(string parameterName, ParameterDirection direction) {
Expand Down
13 changes: 7 additions & 6 deletions source/dbfitTest/NameNormaliserTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@

using dbfit.util;
using NUnit.Framework;
using NUnit.Framework.Legacy;

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"));
ClassicAssert.AreEqual("dbtest", NameNormaliser.NormaliseName("dbtest?"));
ClassicAssert.AreEqual("dbtest", NameNormaliser.NormaliseName("db test"));
ClassicAssert.AreEqual("dbtest", NameNormaliser.NormaliseName("db test?"));
ClassicAssert.AreEqual("db.test", NameNormaliser.NormaliseName("db.test"));
ClassicAssert.AreEqual("db_test", NameNormaliser.NormaliseName("db_test"));
ClassicAssert.AreEqual("dbtest", NameNormaliser.NormaliseName("DbTeSt"));
}
}
}
20 changes: 10 additions & 10 deletions source/dbfitTest/OracleEnvironmentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,37 @@
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;

using NUnit.Framework.Legacy;

namespace dbfit {
[TestFixture]
public class OracleEnvironmentTest {
private OracleEnvironment oe=new OracleEnvironment();
[Test]
public void CheckEmptyParams() {
Assert.AreEqual(0,oe.ExtractParamNames("select * from dual").Length);
ClassicAssert.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"));
ClassicAssert.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);
ClassicAssert.AreEqual(2,paramnames.Length);
ClassicAssert.Contains("mydate", paramnames);
ClassicAssert.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);
ClassicAssert.AreEqual(2, paramnames.Length);
ClassicAssert.Contains("mydate", paramnames);
ClassicAssert.Contains("myname", paramnames);
}
[Test]
public void CheckUnderscore() {
Assert.AreEqual(new string[] { "my_date" }, oe.ExtractParamNames("select * from dual where sysdate<:my_date"));
ClassicAssert.AreEqual(new string[] { "my_date" }, oe.ExtractParamNames("select * from dual where sysdate<:my_date"));
}
}
}
5 changes: 3 additions & 2 deletions source/dbfitTest/QueryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using fit.Service;
using fitSharp.Machine.Model;
using NUnit.Framework;
using NUnit.Framework.Legacy;
using TestStatus=fitSharp.Fit.Model.TestStatus;

namespace dbfitTest {
Expand Down Expand Up @@ -46,8 +47,8 @@ private static void AssertQuery(string columnName, string headerCellName) {
);
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));
ClassicAssert.AreEqual(TestStatus.Right, parseTable.At(0, 2, 0).GetAttribute(CellAttribute.Status));
ClassicAssert.AreEqual(TestStatus.Right, parseTable.At(0, 2, 1).GetAttribute(CellAttribute.Status));
}
}
}
7 changes: 4 additions & 3 deletions source/dbfitTest/SqlServerEnvironmentTest.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// 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.

using System.Data.Common;
using dbfit;
using NUnit.Framework;
using NUnit.Framework.Legacy;

namespace dbfitTest {
[TestFixture] public class SqlServerEnvironmentTest {
Expand All @@ -19,7 +20,7 @@ [Test] public void BuildsInsertCommand() {
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);
ClassicAssert.AreEqual("insert into aTable([aColumn],[bColumn]) values (@aParameter,@bParameter)", command);
}

static DbParameter MakeParameter(SqlServerEnvironment environment, string sourceColumn, string parameterName) {
Expand All @@ -45,7 +46,7 @@ [Test] public void BuildUpdateCommand() {
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);
ClassicAssert.AreEqual("update aTable set [aColumn]=@aParameter, [bColumn]=@bParameter where [cColumn]=@cParameter and [dColumn]=@dParameter", command);
}
}
}
4 changes: 2 additions & 2 deletions source/dbfitTest/dbfitTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Moq" Version="4.8.3" />
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="nunit" Version="4.2.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.0" />
</ItemGroup>
<ItemGroup>
Expand Down
6 changes: 4 additions & 2 deletions source/fitSharp/Machine/Application/Shell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Loading

0 comments on commit cbbd8d3

Please sign in to comment.