Exemple #1
0
        public InjectedTestCommandTests()
        {
            _testCommand        = Substitute.For <ITestCommand>();
            _testFixtureScope   = Substitute.For <ITestFixtureScope>();
            _testFixtureFactory = Substitute.For <ITestFixtureFactory>();

            _sut = new InjectedTestCommand(_testCommand, _testFixtureFactory);
        }
        public void Throw_if_class_has_no_test_methods()
        {
            //Arrange
            testDetector = new Core.TestFixtureFactory(new TestDetector());

            //Assert
            Assert.Throws <InvalidOperationException>(
                () => testDetector.GetTestFixture(typeof(SimpleClass)));
        }
 public TestFramework(
     ITestFixtureFactory testFixtureFactory,
     IDirectoryScanner directoryScanner,
     IAssemblyScanner assemblyScanner
     )
 {
     this.testFixtureFactory = testFixtureFactory;
     this.directoryScanner   = directoryScanner;
     this.assemblyScanner    = assemblyScanner;
 }
        public void Create_test_without_setup_if_no_setup_method_present()
        {
            //Arrange
            testDetector = new Core.TestFixtureFactory(new TestDetector());

            //Act
            testDetector.GetTestFixture(typeof(NoSetupMock)).Run();

            //Assert
            Assert.Equal(1, NoSetupMock.testRun);
        }
        public void Create_test_fixture_if_class_has_multiple_tests()
        {
            //Arrange
            testDetector = new Core.TestFixtureFactory(new TestDetector());

            //Act
            var createdTest = testDetector.GetTestFixture(typeof(MultipleTestFixture));

            //Assert
            Assert.IsType <Core.TestFixture>(createdTest);
        }
        public void Create_test_case_if_class_has_only_one_test()
        {
            //Arrange
            testDetector = new Core.TestFixtureFactory(new TestDetector());

            //Act
            var createdTest = testDetector.GetTestFixture(typeof(MockFixture));

            //Assert
            Assert.IsType <Core.TestCase>(createdTest);
        }
        public void Create_test_fixture_with_add_test_cases_containing_setup()
        {
            //Arrange
            testDetector = new Core.TestFixtureFactory(new TestDetector());

            //Act
            var createdTest = testDetector.GetTestFixture(typeof(MockFixture2));

            createdTest.Run();

            //Assert
            Assert.Equal(2, MockFixture.setupRun);
        }
        public void Create_test_fixture_containing_all_tests()
        {
            //Arrange
            testDetector = new Core.TestFixtureFactory(new TestDetector());

            //Act
            var createdTest = testDetector.GetTestFixture(typeof(MockFixture2));

            createdTest.Run();

            //Assert
            Assert.Equal(2, MockFixture.testRun);
        }
        public void Create_test_with_setup_when_class_has_setup()
        {
            //Arrange
            testDetector = new Core.TestFixtureFactory(new TestDetector());

            //Act
            var createdTest = testDetector.GetTestFixture(typeof(MockFixture));

            createdTest.Run();

            //Assert
            Assert.Equal(1, MockFixture.setupRun);
        }
 public InjectedTestCommand(ITestCommand testCommand, ITestFixtureFactory testFixtureFactory)
 {
     _testCommand        = testCommand;
     _testFixtureFactory = testFixtureFactory;
 }