public void TestExcludedProperties() { var tester = new AssemblyTester(typeof(IncorrectConstructors).Assembly); tester.Exclusions.AddType(typeof(GenericClass<>)); tester.AddPropertyExclusions(typeof(IncorrectProperties), "Dummy4", "Dummy3"); tester.TestAssembly(true, false); }
public void TestExcludedPropertiesLambda() { var tester = new AssemblyTester(typeof(IncorrectConstructors).Assembly); tester.Exclusions.AddType(typeof(GenericClass<>)); tester.AddConstructorExclusion(() => new IncorrectConstructors(string.Empty,0, false,string.Empty)); tester.AddConstructorExclusion(() => new IncorrectConstructors(string.Empty, string.Empty)); tester.TestAssembly(false, true); }
public void TestExcludedProperties() { var tester = new AssemblyTester(typeof(IncorrectConstructors).Assembly); tester.Exclusions.AddType(typeof(GenericClass<>)); tester.AddConstructorExclusion(typeof(IncorrectConstructors), typeof(string), typeof(int), typeof(bool), typeof(string)); tester.AddConstructorExclusion(typeof(IncorrectConstructors), typeof(string), typeof(string)); tester.TestAssembly(false, true); }
public void TestExcludedPropertiesWithLambda() { var tester = new AssemblyTester(typeof(IncorrectConstructors).Assembly); tester.Exclusions.AddType(typeof(GenericClass<>)); tester.AddPropertyExclusion<IncorrectProperties>(x => x.Dummy4); tester.AddPropertyExclusion<IncorrectProperties>(x => x.Dummy3); tester.TestAssembly(true, false); }
static void Main(string[] args) { var testSuite = new TestSuite(); testSuite.Add( methodName: nameof(SampleAssembly.ClassWithMethodsDefaultTypes.SumTwoInts), testCases: new TestCase() { Inputs = new object[] { 2, 3 }, Output = 5 } ); testSuite.Add( methodName: nameof(SampleAssembly.ClassWithMethodsDefaultTypes.MultiplyTwoInts), testCases: new TestCase() { Inputs = new object[] { 2, 3 }, Output = 6 } ); testSuite.Add( methodName: nameof(SampleAssembly.ClassWithMethodsDefaultTypes.StringLengthMatch), testCases: new TestCase() { Inputs = new object[] { "abc", 3 }, Output = true } ); var customType = new ClassWithDefaultCtr() { StrProp = "abc" }; testSuite.Add( methodName: nameof(SampleAssembly.ClassWithMethodCustomType.MethodWithCustomType), testCases: new TestCase() { Inputs = new object[] { customType, 3 }, Output = true } ); var projectFilePath = @"C:\Users\user1\source\repos\AutoTester\SampleAssembly\SampleAssembly.csproj"; var results = AssemblyTester.Run(projectFilePath, testSuite); Console.WriteLine($"Test run global result: '{results}'"); Console.ReadLine(); }
public void ExcludeProperty_prevents_testing_a_property() { var sut = new AssemblyTester(Assembly.Load("NSimpleTester.Tests.PropertyErrors")); // verity the assembly has issues first so we know the test is valid. Assert.Throws <InvalidOperationException>(() => sut.TestAssembly()); sut.ExcludeProperty("TestTypeWBadINotifyPropertyChanged", "PropertyTwo"); sut.TestAssembly(); }
public void ExcludeEqualityTests_prevents_any_equality_tests() { var sut = new AssemblyTester(Assembly.Load("NSimpleTester.Tests.EqualityErrors")); // verity the assembly has issues first so we know the test is valid. Assert.Throws <InvalidOperationException>(() => sut.TestAssembly()); sut.ExcludeEqualityTests(); sut.TestAssembly(); }
public void ExcludeConstructor_prevents_any_constructor_tests() { var sut = new AssemblyTester(Assembly.Load("NSimpleTester.Tests.ConstructorErrors")); // verity the assembly has issues first so we know the test is valid. Assert.Throws <InvalidOperationException>(() => sut.TestAssembly()); sut.ExcludeConstructor("ConstructorParameterNotMapped", new MethodSignature(new Type[] {})); sut.TestAssembly(); }
public void ExcludeClass_prevents_executing_any_tests_on_a_class() { var sut = new AssemblyTester(Assembly.Load("NSimpleTester.Tests.ConstructorErrors")); // verity the assembly has issues first so we know the test is valid. Assert.Throws <InvalidOperationException>(() => sut.TestAssembly()); sut.ExcludeClass("ConstructorParameterNotMapped"); sut.TestAssembly(); }
public void TestAll_suceeds() { var testResults = AssemblyTester.TestAll("SampleAssembly"); Assert.IsTrue(testResults.Succeeded, "Expects test to succeed."); }