public ClassTester(string name, Object testedInstance)
 {
     if (testedInstance==null)
         throw new ArgumentNullException("testedInstance");
     this.suite=new TestSuite(name);
     this.testedInstance=testedInstance;
 }
        public static IEnumerable<Test> CreateTests()
        {
            catalog.RegisterBuilder<Messages.UriWithQuotesAndSlashes>().WithPostConstruction(m =>
            {
                var tm = m as Messages.UriWithQuotesAndSlashes;
                tm.ValueWithQuotes = new Uri(Messages.UriWithQuotesAndSlashes.UriQuotes);
                tm.ValueWithSlashes = new Uri(Messages.UriWithQuotesAndSlashes.UriSlash);
            });
            catalog.RegisterBuilder<ObjectPropertyWithCustomValue>().WithPostConstruction(o => ((ObjectPropertyWithCustomValue)o).Value = catalog.CreateInstance<CustomObject>());

            foreach (Type serializer in GetSerializers())
            {
                string name = serializer.Name.Replace("Adapter`1", "");

                TestSuite test = new TestSuite(name);
                foreach (Type message in GetMessages())
                {
                    test.Children.Add(BuildTestCase(serializer, message));
                    test.Children.Add(BuildObjectTreeTestCase(serializer, message));
                }
                foreach (TestCase testCase in BuildEnumerableTests(serializer))
                {
                    test.Children.Add(testCase);
                }
                yield return test;
            }
        }
 public void AddDuplicateTestCase2()
 {
     TestSuite suite = new TestSuite("Suite");
     TestCase tc = new TestCase("Test", new TestDelegate(this.Test));
     suite.Add(tc);
     suite.Add(tc);
 }
 public void AddTestCase()
 {
     TestSuite suite = new TestSuite("Suite");
     TestCase tc = suite.Add("Test", new TestDelegate(this.Test));
     Assert.IsNotNull(tc);
     Assert.AreEqual(1, suite.TestCases.Count);
 }
Exemple #5
0
        public void ConstructorRequiresName()
        {
            Assert.Throws<ArgumentNullException>(() => new TestSuite(null));

            TestSuite testSuite = new TestSuite("Name");
            Assert.AreEqual("Name", testSuite.Name);
        }
 public TestSuite Suite()
 {
     TestSuite suite = new TestSuite("SimpleSuite");
     suite.Add( "Test1", new TestDelegate( this.Test ), "hello" );
     suite.Add( "Test2", new TestDelegate( this.AnotherTest), "another test" );
     return suite;
 }
 public TestSuite GetSuite()
 {
     TestSuite suite = new TestSuite("Suite1");
     suite.Add( "Setup 1, Teardown 0", new TestDelegate( this.Test ), 1, 0 );
     suite.Add( "Setup 2, Teardown 1", new TestDelegate( this.Test ), 2, 1 );
     suite.Add( "Setup 3, Teardown 2", new TestDelegate( this.Test ), 3, 2 );
     return suite;
 }
 public TestSuite VerifiedSuite()
 {
     TestSuite suite = new TestSuite("VerifiedSuite");
     TestCase tc = TestCases.Case("Verify that tests returns hello world", new TestDelegate(this.TestReturnHelloWorld),"hello");
     VerifiedTestCase vtc = TestCases.Verified(tc,this.helloWorld);
     suite.Add(vtc);
     return suite;
 }
        public TestSuite ExpectedExceptionSuite()
        {
            TestSuite suite = new TestSuite("ExpectedExceptionSuite");

            ITestCase tc = TestCases.Case("Verfiy that tests throw", new TestDelegate(this.ThrowMe));
            ITestCase etc = TestCases.ExpectedException(tc, typeof(Exception));
            suite.Add(etc);
            return suite;
        }
Exemple #10
0
        public void CodeElement()
        {
            TestSuite testSuite = new TestSuite("Name");
            Assert.IsNull(testSuite.CodeElement);

            ITypeInfo type = Reflector.Wrap(typeof(TestSuite));
            testSuite.CodeElement = type;
            Assert.AreSame(type, testSuite.CodeElement);
        }
 public MethodTester(string name, Object testedInstance, MethodInfo method, params Object[] parameters)
 {
     this.suite=new TestSuite(name);
     this.testedInstance=testedInstance;
     this.method = method;
     this.parameterInfos=method.GetParameters();
     this.parameters = parameters;
     this.nullableAttribute = NullableAttributeAttribute.GetAttribute(method.DeclaringType);
 }
        public static IEnumerable<Test> CreateTests()
        {
            // build suite
            TestSuite commandsSuite = new TestSuite("messages");

            foreach (Type message in GetMessages())
            {
                // build test case for each message type
                commandsSuite.Children.Add( BuildTestCase(message));
            }
            yield return commandsSuite;
        }
Exemple #13
0
        public void TimeoutMustBeNullOrPositive()
        {
            TestSuite testSuite = new TestSuite("Name");
            Assert.IsNull(testSuite.Timeout);

            testSuite.Timeout = TimeSpan.FromSeconds(5);
            Assert.AreEqual(TimeSpan.FromSeconds(5), testSuite.Timeout);

            testSuite.Timeout = null;
            Assert.IsNull(testSuite.Timeout);

            Assert.Throws<ArgumentOutOfRangeException>(() => testSuite.Timeout = TimeSpan.FromSeconds(-1));
        }
Exemple #14
0
        public void DescriptionStoredInMetadata()
        {
            TestSuite testSuite = new TestSuite("Name");
            Assert.IsNull(testSuite.Description);
            Assert.IsFalse(testSuite.Metadata.ContainsKey(MetadataKeys.Description));

            testSuite.Description = "Description";
            Assert.AreEqual("Description", testSuite.Description);
            Assert.AreEqual("Description", testSuite.Metadata.GetValue(MetadataKeys.Description));

            testSuite.Description = null;
            Assert.IsNull(testSuite.Description);
            Assert.IsFalse(testSuite.Metadata.ContainsKey(MetadataKeys.Description));
        }
        public static IEnumerable<Test> CreateTests()
        {
            foreach (Type serializer in GetSerializers())
            {
                string name = serializer.Name.Replace("Adapter`1","");

                TestSuite test = new TestSuite(name);
                foreach(Type message in GetMessages())
                {
                    test.Children.Add(BuildTestCase(serializer, message));
                }
                foreach (TestCase testCase in BuildEnumerableTests(serializer))
                {
                    test.Children.Add(testCase);
                }

                yield return test;
            }
        }
 public ITestSuite Decorate(ITestSuite suite)
 {
     TestSuite checkedSuite = new TestSuite(suite.Name);
     foreach (ITestCase testCase in suite.TestCases)
     {
         PerformanceCounterCheckerTestCase checkedTestCase = new PerformanceCounterCheckerTestCase(this,testCase);
         checkedSuite.Add(checkedTestCase);
     }
     return checkedSuite;
 }
 public TestSuite GetSuite()
 {
     TestSuite suite = new TestSuite("SeparateClass");
     suite.Add( "TestClassA", new VoidTestDelegate(classA.SomeMethodA ) );
     return suite;
 }
 public TestSuite GetSuite()
 {
     TestSuite suite = new TestSuite("Suite1");
     suite.Add( "SomeSuiteDefinedTest", new TestDelegate( this.SomeSuiteDefinedTest ) );
     return suite;
 }
 public void AddEmptyName()
 {
     TestSuite suite = new TestSuite("Suite");
     suite.Add("", new TestDelegate(this.Test));
 }
 public void AddNullName()
 {
     TestSuite suite = new TestSuite("Suite");
     suite.Add(null, new TestDelegate(this.Test));
 }
Exemple #21
0
        public void TearDown()
        {
            TestSuite testSuite = new TestSuite("Name");
            Assert.IsNull(testSuite.TearDown);

            Action action = delegate { };
            testSuite.TearDown = action;
            Assert.AreSame(action, testSuite.TearDown);
        }
Exemple #22
0
        public void SetUp()
        {
            TestSuite testSuite = new TestSuite("Name");
            Assert.IsNull(testSuite.SetUp);

            Action action = delegate { };
            testSuite.SetUp = action;
            Assert.AreSame(action, testSuite.SetUp);
        }
 public void AddNullTestCase()
 {
     TestSuite suite = new TestSuite("Suite");
     suite.Add(null);
 }
 public void EmptyName()
 {
     TestSuite suite = new TestSuite("");
 }
 public void NullName()
 {
     TestSuite suite = new TestSuite(null);
 }
 public TestSuite GetSuite()
 {
     TestSuite suite = new TestSuite("Suite1");
     suite.Add( "TestExpectedException", new TestDelegate(this.TestThrowsException ) );
     return suite;
 }