public Create ( IMethodInfo testMethod, ISpecimenBuilderFactory builderFactory ) : IEnumerable |
||
testMethod | IMethodInfo | /// Information about a test method. /// |
builderFactory | ISpecimenBuilderFactory | /// A factory of test fixture. /// |
return | IEnumerable |
public void CreateShouldNotCreateAnyCommandsWhenReturningEnumerable() { var factory1 = Mocked.Of<ITestCommandFactory>(); var factory2 = Mocked.Of<ITestCommandFactory>(); var sut = new CompositeTestCommandFactory(factory1, factory2); sut.Create(Mocked.Of<IMethodInfo>(), Mocked.Of<ISpecimenBuilderFactory>()); factory1.ToMock().Verify( x => x.Create(It.IsAny<IMethodInfo>(), It.IsAny<ISpecimenBuilderFactory>()), Times.Never()); factory2.ToMock().Verify( x => x.Create(It.IsAny<IMethodInfo>(), It.IsAny<ISpecimenBuilderFactory>()), Times.Never()); }
public void CreateReturnsEmptyIfAllFactoriesReturnEmpty() { var method = Mocked.Of<IMethodInfo>(); var fixtureFactory = Mocked.Of<ISpecimenBuilderFactory>(); var factory1 = Mocked.Of<ITestCommandFactory>( f => f.Create(method, fixtureFactory) == new ITestCommand[0]); var factory2 = Mocked.Of<ITestCommandFactory>( f => f.Create(method, fixtureFactory) == new ITestCommand[0]); var sut = new CompositeTestCommandFactory(factory1, factory2); var actual = sut.Create(method, fixtureFactory); Assert.Empty(actual); }
public void CreateReturnsCorrectTestCommands() { var method = Mocked.Of<IMethodInfo>(); var fixtureFactory = Mocked.Of<ISpecimenBuilderFactory>(); var expected = new[] { Mocked.Of<ITestCommand>(), Mocked.Of<ITestCommand>() }; var factory1 = Mocked.Of<ITestCommandFactory>( f => f.Create(method, fixtureFactory) == new ITestCommand[0]); var factory2 = Mocked.Of<ITestCommandFactory>( f => f.Create(method, fixtureFactory) == expected); var factory3 = Mocked.Of<ITestCommandFactory>( f => f.Create(method, fixtureFactory) == new[] { Mocked.Of<ITestCommand>(), Mocked.Of<ITestCommand>() }); var sut = new CompositeTestCommandFactory(factory1, factory2, factory3); var actual = sut.Create(method, fixtureFactory); Assert.Equal(expected, actual); }