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); }
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>()); }
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>()); }
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); }
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); }
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(); }