Skip to content

Commit 4be7b5d

Browse files
committed
Moved UnitTests to MSTest
1 parent 2770c7b commit 4be7b5d

34 files changed

+743
-746
lines changed

ObjectFillerNET.sln

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
77
EndProject
88
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tynamix.ObjectFiller", "Tynamix.ObjectFiller\Tynamix.ObjectFiller.csproj", "{3208D63E-1A26-453C-8A31-03491CD23780}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tynamix.ObjectFiller.Test", "Tynamix.ObjectFiller.Test\Tynamix.ObjectFiller.Test.csproj", "{AF85E17E-BAA1-4580-A302-9935D8AC1E95}"
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tynamix.Objectfiller.Test", "Tynamix.Objectfiller.Test\Tynamix.Objectfiller.Test.csproj", "{76592E58-909C-4AE7-9FE4-6AD415AE1D80}"
1111
EndProject
1212
Global
1313
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -31,18 +31,18 @@ Global
3131
{3208D63E-1A26-453C-8A31-03491CD23780}.Release|x64.Build.0 = Release|x64
3232
{3208D63E-1A26-453C-8A31-03491CD23780}.Release|x86.ActiveCfg = Release|x86
3333
{3208D63E-1A26-453C-8A31-03491CD23780}.Release|x86.Build.0 = Release|x86
34-
{AF85E17E-BAA1-4580-A302-9935D8AC1E95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35-
{AF85E17E-BAA1-4580-A302-9935D8AC1E95}.Debug|Any CPU.Build.0 = Debug|Any CPU
36-
{AF85E17E-BAA1-4580-A302-9935D8AC1E95}.Debug|x64.ActiveCfg = Debug|x64
37-
{AF85E17E-BAA1-4580-A302-9935D8AC1E95}.Debug|x64.Build.0 = Debug|x64
38-
{AF85E17E-BAA1-4580-A302-9935D8AC1E95}.Debug|x86.ActiveCfg = Debug|x86
39-
{AF85E17E-BAA1-4580-A302-9935D8AC1E95}.Debug|x86.Build.0 = Debug|x86
40-
{AF85E17E-BAA1-4580-A302-9935D8AC1E95}.Release|Any CPU.ActiveCfg = Release|Any CPU
41-
{AF85E17E-BAA1-4580-A302-9935D8AC1E95}.Release|Any CPU.Build.0 = Release|Any CPU
42-
{AF85E17E-BAA1-4580-A302-9935D8AC1E95}.Release|x64.ActiveCfg = Release|x64
43-
{AF85E17E-BAA1-4580-A302-9935D8AC1E95}.Release|x64.Build.0 = Release|x64
44-
{AF85E17E-BAA1-4580-A302-9935D8AC1E95}.Release|x86.ActiveCfg = Release|x86
45-
{AF85E17E-BAA1-4580-A302-9935D8AC1E95}.Release|x86.Build.0 = Release|x86
34+
{76592E58-909C-4AE7-9FE4-6AD415AE1D80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35+
{76592E58-909C-4AE7-9FE4-6AD415AE1D80}.Debug|Any CPU.Build.0 = Debug|Any CPU
36+
{76592E58-909C-4AE7-9FE4-6AD415AE1D80}.Debug|x64.ActiveCfg = Debug|Any CPU
37+
{76592E58-909C-4AE7-9FE4-6AD415AE1D80}.Debug|x64.Build.0 = Debug|Any CPU
38+
{76592E58-909C-4AE7-9FE4-6AD415AE1D80}.Debug|x86.ActiveCfg = Debug|Any CPU
39+
{76592E58-909C-4AE7-9FE4-6AD415AE1D80}.Debug|x86.Build.0 = Debug|Any CPU
40+
{76592E58-909C-4AE7-9FE4-6AD415AE1D80}.Release|Any CPU.ActiveCfg = Release|Any CPU
41+
{76592E58-909C-4AE7-9FE4-6AD415AE1D80}.Release|Any CPU.Build.0 = Release|Any CPU
42+
{76592E58-909C-4AE7-9FE4-6AD415AE1D80}.Release|x64.ActiveCfg = Release|Any CPU
43+
{76592E58-909C-4AE7-9FE4-6AD415AE1D80}.Release|x64.Build.0 = Release|Any CPU
44+
{76592E58-909C-4AE7-9FE4-6AD415AE1D80}.Release|x86.ActiveCfg = Release|Any CPU
45+
{76592E58-909C-4AE7-9FE4-6AD415AE1D80}.Release|x86.Build.0 = Release|Any CPU
4646
EndGlobalSection
4747
GlobalSection(SolutionProperties) = preSolution
4848
HideSolutionNode = FALSE

Tynamix.ObjectFiller.Test/BugfixTests/Bug68HashsetCanNotBeCreated.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,25 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading.Tasks;
5+
using Microsoft.VisualStudio.TestTools.UnitTesting;
56

67
namespace ObjectFiller.Test.BugfixTests
78
{
89
using Tynamix.ObjectFiller;
910

10-
using Xunit;
11+
1112

1213
public class Bug68HashsetCanNotBeCreated
1314
{
14-
[Fact]
15+
[TestMethod]
1516
public void AHashsetShouldBeGenerated()
1617
{
1718
Filler<HashSet<string>> filler = new Filler<HashSet<string>>();
1819

1920
var hashset = filler.Create();
2021

21-
Assert.NotNull(hashset);
22-
Assert.True(hashset.Any());
22+
Assert.IsNotNull(hashset);
23+
Assert.IsTrue(hashset.Any());
2324
}
2425
}
2526
}

Tynamix.ObjectFiller.Test/BugfixTests/Bug87ErrorWhenNameInParentIsSameAsParent.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading.Tasks;
5+
using Microsoft.VisualStudio.TestTools.UnitTesting;
56

67
namespace ObjectFiller.Test.BugfixTests
78
{
89
using Tynamix.ObjectFiller;
910

10-
using Xunit;
11+
1112

1213
public class Bug87ErrorWhenNameInParentIsSameAsParent
1314
{
@@ -24,15 +25,15 @@ public class Child
2425
public string MakeTheError { get; set; }
2526
}
2627

27-
[Fact]
28+
[TestMethod]
2829
public void ParentShallGetFilledWithourError()
2930
{
3031
Filler<Parent> filler = new Filler<Parent>();
3132

3233
var filledObject = filler.Create();
33-
Assert.NotNull(filledObject);
34-
Assert.NotNull(filledObject.MakeTheError);
35-
Assert.False(string.IsNullOrWhiteSpace(filledObject.Child.MakeTheError));
34+
Assert.IsNotNull(filledObject);
35+
Assert.IsNotNull(filledObject.MakeTheError);
36+
Assert.IsFalse(string.IsNullOrWhiteSpace(filledObject.Child.MakeTheError));
3637
}
3738
}
3839
}

Tynamix.ObjectFiller.Test/BugfixTests/Bug89FillTypesInheritsFromDictionary.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading.Tasks;
5+
using Microsoft.VisualStudio.TestTools.UnitTesting;
56

67
namespace ObjectFiller.Test.BugfixTests
78
{
89
using Tynamix.ObjectFiller;
910

10-
using Xunit;
11+
1112

1213

1314
public class Bug89FillTypesInheritsFromDictionary
@@ -28,16 +29,16 @@ public class EntityBList : Dictionary<string, EntityB>
2829
public DateTime SomeDate { get; set; }
2930
}
3031

31-
[Fact]
32+
[TestMethod]
3233
public void ADerivedDictionaryShallGetFilledAllProperties()
3334
{
3435
Filler<EntityA> filler = new Filler<EntityA>();
3536

3637
var result = filler.Create();
3738

38-
Assert.NotNull(result.Bs);
39-
Assert.InRange(result.Bs.SomeDate, DateTime.MinValue.AddSeconds(1), DateTime.MaxValue.AddSeconds(-1));
40-
Assert.True(result.Bs.Any());
39+
Assert.IsNotNull(result.Bs);
40+
Assert.IsTrue(result.Bs.SomeDate > DateTime.MinValue.AddSeconds(1) && result.Bs.SomeDate < DateTime.MaxValue.AddSeconds(-1));
41+
Assert.IsTrue(result.Bs.Any());
4142
}
4243
}
4344
}

Tynamix.ObjectFiller.Test/BugfixTests/Bug89FillTypesInheritsFromList.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading.Tasks;
5+
using Microsoft.VisualStudio.TestTools.UnitTesting;
56

67
namespace ObjectFiller.Test.BugfixTests
78
{
89
using Tynamix.ObjectFiller;
910

10-
using Xunit;
11+
1112

1213

1314
public class Bug89FillTypesInheritsFromList
@@ -28,16 +29,16 @@ public class EntityBList : List<EntityB>
2829
public DateTime SomeDate { get; set; }
2930
}
3031

31-
[Fact]
32+
[TestMethod]
3233
public void ADerivedListShallGetFilledAllProperties()
3334
{
3435
Filler<EntityA> filler = new Filler<EntityA>();
3536

3637
var result = filler.Create();
3738

38-
Assert.NotNull(result.Bs);
39-
Assert.InRange(result.Bs.SomeDate, DateTime.MinValue.AddSeconds(1), DateTime.MaxValue.AddSeconds(-1));
40-
Assert.True(result.Bs.Any());
39+
Assert.IsNotNull(result.Bs);
40+
Assert.IsTrue(result.Bs.SomeDate > DateTime.MinValue.AddSeconds(1) && result.Bs.SomeDate < DateTime.MaxValue.AddSeconds(-1));
41+
Assert.IsTrue(result.Bs.Any());
4142
}
4243
}
4344
}
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1+
using Microsoft.VisualStudio.TestTools.UnitTesting;
2+
13
namespace ObjectFiller.Test
24
{
3-
using Xunit;
5+
46

57
using Tynamix.ObjectFiller;
68

7-
9+
[TestClass]
810
public class CityNamesPluginTest
911
{
10-
[Fact]
12+
[TestMethod]
1113
public void RandomNameIsReturned()
1214
{
1315
var sut = new CityName();
1416
var value = sut.GetValue();
1517

16-
Assert.False(string.IsNullOrEmpty(value));
18+
Assert.IsFalse(string.IsNullOrEmpty(value));
1719
}
1820
}
1921
}

Tynamix.ObjectFiller.Test/CollectionizerTest.cs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
using System.Collections.Generic;
33
using System.Diagnostics;
44
using System.Linq;
5+
using Microsoft.VisualStudio.TestTools.UnitTesting;
56
using Tynamix.ObjectFiller;
6-
using Xunit;
7+
78

89
namespace ObjectFiller.Test
910
{
@@ -16,9 +17,10 @@ public class CollectionizerPoco
1617
public ArrayList ArrayList { get; set; }
1718
}
1819

20+
[TestClass]
1921
public class CollectionizerTest
2022
{
21-
[Fact]
23+
[TestMethod]
2224
public void TestCityNames()
2325
{
2426
var filler = new Filler<CollectionizerPoco>();
@@ -28,11 +30,11 @@ public void TestCityNames()
2830
.Use(new Collectionizer<string, MnemonicString>(new MnemonicString(1, 20, 25), 3, 10));
2931

3032
var arrayList = filler.Create();
31-
Assert.True(arrayList.ArrayList.Count >= 3 && arrayList.ArrayList.Count <= 10);
32-
Assert.True(arrayList.ArrayList.ToArray().Cast<string>().All(x => x.Length >= 20 && x.Length <= 25));
33+
Assert.IsTrue(arrayList.ArrayList.Count >= 3 && arrayList.ArrayList.Count <= 10);
34+
Assert.IsTrue(arrayList.ArrayList.ToArray().Cast<string>().All(x => x.Length >= 20 && x.Length <= 25));
3335
}
3436

35-
[Fact]
37+
[TestMethod]
3638
public void TestMnemonicStringPlugin()
3739
{
3840
var filler = new Filler<CollectionizerPoco>();
@@ -42,11 +44,11 @@ public void TestMnemonicStringPlugin()
4244
.Use(new Collectionizer<string, MnemonicString>(new MnemonicString(1, 20, 25), 3, 10));
4345

4446
var collection = filler.Create();
45-
Assert.True(collection.MnemonicStrings.Count() >= 3 && collection.MnemonicStrings.Count() <= 10);
46-
Assert.True(collection.MnemonicStrings.All(x => x.Length >= 20 && x.Length <= 25));
47+
Assert.IsTrue(collection.MnemonicStrings.Count() >= 3 && collection.MnemonicStrings.Count() <= 10);
48+
Assert.IsTrue(collection.MnemonicStrings.All(x => x.Length >= 20 && x.Length <= 25));
4749
}
4850

49-
[Fact]
51+
[TestMethod]
5052
public void TestMnemonicStringPluginTest()
5153
{
5254
var filler = new Filler<CollectionizerPoco>();
@@ -56,14 +58,14 @@ public void TestMnemonicStringPluginTest()
5658

5759
var collection = filler.Create();
5860

59-
Assert.NotNull(collection);
60-
Assert.NotNull(collection.MnemonicStrings);
61-
Assert.NotEmpty(collection.MnemonicStrings);
61+
Assert.IsNotNull(collection);
62+
Assert.IsNotNull(collection.MnemonicStrings);
63+
Assert.IsTrue(collection.MnemonicStrings.Any());
6264

6365
collection.MnemonicStrings.ToList().ForEach(s => Debug.WriteLine(s));
6466
}
6567

66-
[Fact]
68+
[TestMethod]
6769
public void TestIntRangePlugin()
6870
{
6971
var filler = new Filler<CollectionizerPoco>();
@@ -73,8 +75,8 @@ public void TestIntRangePlugin()
7375
.Use(new Collectionizer<int, IntRange>(new IntRange(10, 15), 3, 10));
7476

7577
var collection = filler.Create();
76-
Assert.True(collection.IntRange.Count >= 3 && collection.IntRange.Count() <= 10);
77-
Assert.True(collection.IntRange.All(x => x >= 10 && x <= 15));
78+
Assert.IsTrue(collection.IntRange.Count >= 3 && collection.IntRange.Count() <= 10);
79+
Assert.IsTrue(collection.IntRange.All(x => x >= 10 && x <= 15));
7880
}
7981
}
8082
}

Tynamix.ObjectFiller.Test/CopyConstructorTest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
using System;
2-
using Xunit;
2+
using Microsoft.VisualStudio.TestTools.UnitTesting;
33
using Tynamix.ObjectFiller;
44

55
namespace ObjectFiller.Test
66
{
7-
7+
[TestClass]
88
public class CopyConstructorTest
99
{
1010

11-
[Fact]
11+
[TestMethod]
1212
public void WhenClassWithCopyConstructorIsCreatedNoExceptionShallBeThrown()
1313
{
1414
var f = new Filler<ClassWithCopyConstructorAndNormalConstructor>();
1515
var cc = f.Create();
1616

17-
Assert.NotNull(cc);
17+
Assert.IsNotNull(cc);
1818
}
1919

20-
[Fact]
20+
[TestMethod]
2121
public void WhenClassWithJustCopyConstructorIsCreatedAExceptionShallBeThrown()
2222
{
2323
var f = new Filler<ClassWithCopyConstructor>();
24-
Assert.Throws<InvalidOperationException>(() => f.Create());
24+
Assert.ThrowsException<InvalidOperationException>(() => f.Create());
2525

2626
}
2727
}
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1+
using Microsoft.VisualStudio.TestTools.UnitTesting;
2+
13
namespace ObjectFiller.Test
24
{
3-
using Xunit;
5+
46

57
using Tynamix.ObjectFiller;
68

7-
9+
[TestClass]
810
public class CountryNamesPlugin
911
{
10-
[Fact]
12+
[TestMethod]
1113
public void RandomNameIsReturned()
1214
{
1315
var sut = new CountryName();
1416
var value = sut.GetValue();
1517

16-
Assert.False(string.IsNullOrEmpty(value));
18+
Assert.IsFalse(string.IsNullOrEmpty(value));
1719
}
1820
}
1921
}

Tynamix.ObjectFiller.Test/CreateInstanceTest.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Collections.Generic;
22
using System.Linq;
3-
using Xunit;
3+
using Microsoft.VisualStudio.TestTools.UnitTesting;
44
using Tynamix.ObjectFiller;
55

66
namespace ObjectFiller.Test
@@ -49,11 +49,11 @@ public ParentOfParent()
4949
}
5050

5151

52-
52+
[TestClass]
5353
public class CreateInstanceTest
5454
{
5555

56-
[Fact]
56+
[TestMethod]
5757
public void TestCreateInstanceOfChildOne()
5858
{
5959
Filler<ParentOfParent> p = new Filler<ParentOfParent>();
@@ -64,12 +64,12 @@ public void TestCreateInstanceOfChildOne()
6464

6565
var pop = p.Create();
6666

67-
Assert.NotNull(pop);
68-
Assert.NotNull(pop.Parents);
69-
Assert.True(pop.Parents.All(x => x is ChildOne));
70-
Assert.False(pop.Parents.Any(x => x is ChildTwo));
67+
Assert.IsNotNull(pop);
68+
Assert.IsNotNull(pop.Parents);
69+
Assert.IsTrue(pop.Parents.All(x => x is ChildOne));
70+
Assert.IsFalse(pop.Parents.Any(x => x is ChildTwo));
7171

72-
Assert.True(pop.Parents.Cast<ChildOne>().All(x => x.Name == "TEST"));
72+
Assert.IsTrue(pop.Parents.Cast<ChildOne>().All(x => x.Name == "TEST"));
7373

7474

7575
}

0 commit comments

Comments
 (0)