public void CustomizeAddsAppropriateResidueCollector() { // Arrange var fixtureStub = new FixtureStub(); var sut = new AutoMoqCustomization(); // Act sut.Customize(fixtureStub); // Assert Assert.Contains(sut.Relay, fixtureStub.ResidueCollectors); }
public void WithoutGenerateDelegates_DoesNotAddMockRelayForDelegate() { // Arrange var fixtureStub = new FixtureStub(); var sut = new AutoMoqCustomization { GenerateDelegates = false }; // Act sut.Customize(fixtureStub); // Assert Assert.DoesNotContain(fixtureStub.Customizations, c => c is MockRelay); }
public void WithConfigureMembers_CustomizeAddsPostprocessorToCustomizations() { // Arrange var fixtureStub = new FixtureStub(); var sut = new AutoMoqCustomization { ConfigureMembers = true }; // Act sut.Customize(fixtureStub); // Assert Assert.Contains(fixtureStub.Customizations, builder => builder is Postprocessor); }
public void WithGenerateDelegates_CustomizeAddsRelay() { // Arrange var fixtureStub = new FixtureStub(); var sut = new AutoMoqCustomization { GenerateDelegates = true }; // Act sut.Customize(fixtureStub); // Assert var mockRelay = (MockRelay)fixtureStub.Customizations.Single(c => c is MockRelay); Assert.IsType <DelegateSpecification>(mockRelay.MockableSpecification); }
public void CustomizeAddsAppropriateCustomizations() { // Arrange var fixtureStub = new FixtureStub(); var sut = new AutoMoqCustomization(); // Act sut.Customize(fixtureStub); // Assert var postprocessor = fixtureStub.Customizations.OfType <MockPostprocessor>().Single(); var ctorInvoker = Assert.IsAssignableFrom <MethodInvoker>(postprocessor.Builder); Assert.IsAssignableFrom <MockConstructorQuery>(ctorInvoker.Query); }
public void WithConfigureMembers_CustomizeAddsMockCommandsToPostprocessor(Type expectedCommandType) { // Arrange var fixtureStub = new FixtureStub(); var sut = new AutoMoqCustomization { ConfigureMembers = true }; // Act sut.Customize(fixtureStub); // Assert var postprocessor = (Postprocessor)fixtureStub.Customizations.Single(builder => builder is Postprocessor); var compositeCommand = (CompositeSpecimenCommand)postprocessor.Command; Assert.Contains(compositeCommand.Commands, command => command.GetType() == expectedCommandType); }