コード例 #1
0
        public void ResetSubject_should_allow_a_different_config_to_be_passed()
        {
            var fixture = new AutoMoqTestFixture <Apple>();

            var looseConfig = new Config {
                MockBehavior = MockBehavior.Loose
            };

            fixture.ResetSubject(looseConfig);

            fixture.Subject.DoSomething(); // expecting no error

            var strictConfig = new Config {
                MockBehavior = MockBehavior.Strict
            };

            fixture.ResetSubject(strictConfig);

            var errorHit = false;

            try
            {
                fixture.Subject.DoSomething(); // expecting an error
            }
            catch
            {
                errorHit = true;
            }
            Assert.True(errorHit);
        }
コード例 #2
0
        public void Mocked_dependencies_should_be_accessible()
        {
            var fixture = new AutoMoqTestFixture<ClassWithDependencies>();

            Mock<IDependency> disp = fixture.Mocked<IDependency>();

            Assert.That(disp, Is.Not.Null);
        }
コード例 #3
0
        public void Dependencies_should_be_accessible()
        {
            var fixture = new AutoMoqTestFixture<ClassWithDependencies>();

            IDependency dependency = fixture.Dependency<IDependency>();

            Assert.That( dependency, Is.Not.Null );
        }
コード例 #4
0
        public void Mocked_dependencies_should_be_accessible()
        {
            var fixture = new AutoMoqTestFixture <ClassWithDependencies>();

            Mock <IDependency> disp = fixture.Mocked <IDependency>();

            Assert.NotNull(disp);
        }
コード例 #5
0
        public void Dependencies_should_be_accessible()
        {
            var fixture = new AutoMoqTestFixture <ClassWithDependencies>();

            IDependency dependency = fixture.Dependency <IDependency>();

            Assert.NotNull(dependency);
        }
コード例 #6
0
        public void Dependencies_should_be_accessible()
        {
            var fixture = new AutoMoqTestFixture <ClassWithDependencies>();

            IDependency dependency = fixture.Dependency <IDependency>();

            dependency.Should().NotBeNull();
        }
コード例 #7
0
        public void ResetSubject_should_have_different_mock_dependencies()
        {
            var fixture = new AutoMoqTestFixture<ClassWithDependencies>();

            var origDependency = fixture.Mocked<IDependency>();

            fixture.ResetSubject();

            Assert.AreNotSame(origDependency, fixture.Mocked<IDependency>());
        }
コード例 #8
0
        public void ResetSubject_should_have_different_mock_dependencies()
        {
            var fixture = new AutoMoqTestFixture <ClassWithDependencies>();

            var origDependency = fixture.Mocked <IDependency>();

            fixture.ResetSubject();

            Assert.NotSame(origDependency, fixture.Mocked <IDependency>());
        }
コード例 #9
0
        public void ResetSubject_should_give_another_instance_of_type()
        {
            var fixture = new AutoMoqTestFixture<ClassWithDependencies>();

            ClassWithDependencies instance1 = fixture.Subject;

            fixture.ResetSubject();

            ClassWithDependencies instance2 = fixture.Subject;

            Assert.AreNotSame(instance1,instance2);
        }
コード例 #10
0
        public void ResetSubject_should_give_another_instance_of_type()
        {
            var fixture = new AutoMoqTestFixture <ClassWithDependencies>();

            ClassWithDependencies instance1 = fixture.Subject;

            fixture.ResetSubject();

            ClassWithDependencies instance2 = fixture.Subject;

            Assert.NotSame(instance1, instance2);
        }
コード例 #11
0
        public void ResetSubject_should_allow_a_different_config_to_be_passed()
        {
            var fixture = new AutoMoqTestFixture<Apple>();

            var looseConfig = new Config {MockBehavior = MockBehavior.Loose};
            fixture.ResetSubject(looseConfig);

            fixture.Subject.DoSomething(); // expecting no error

            var strictConfig = new Config {MockBehavior = MockBehavior.Strict};
            fixture.ResetSubject(strictConfig);

            var errorHit = false;
            try
            {
                fixture.Subject.DoSomething(); // expecting an error
            }
            catch
            {
                errorHit = true;
            }
            errorHit.ShouldBeTrue();
        }
コード例 #12
0
        public void Subject_should_be_populated_after_construction()
        {
            var fixture = new AutoMoqTestFixture<ClassWithDependencies>();

            Assert.That( fixture.Subject, Is.Not.Null);
        }
コード例 #13
0
        public void Mocker_should_be_set()
        {
            var fixture = new AutoMoqTestFixture <ClassWithDependencies>();

            Assert.NotNull(fixture.Mocker);
        }
コード例 #14
0
        public void Subject_should_be_populated_after_construction()
        {
            var fixture = new AutoMoqTestFixture <ClassWithDependencies>();

            Assert.NotNull(fixture.Subject);
        }
コード例 #15
0
        public void Mocker_should_be_set()
        {
            var fixture = new AutoMoqTestFixture<ClassWithDependencies>();

            Assert.IsNotNull(fixture.Mocker);
        }
コード例 #16
0
        public void Mocker_should_be_set()
        {
            var fixture = new AutoMoqTestFixture <ClassWithDependencies>();

            fixture.Mocker.Should().NotBeNull();
        }