public void SkippedMethodsAreHandled( string skipReason, ParadigmTestClassCommand sut, IMethodInfo methodToTest) { Mock.Get(methodToTest).Setup(x => x.GetCustomAttributes(typeof (FactAttribute))) .Returns(new[] { Reflector.Wrap(new FactAttribute { Skip = skipReason }) }); sut.ClassStart(); var commands = sut.EnumerateTestCommands(methodToTest).ToList(); Assert.That(commands, Is.OfLength(1)); Assert.That(commands[0], Describe.Object<ITestCommand>() .Cast<SkipCommand>(c => c.Property(x => x.Reason, Is.EqualTo(skipReason)))); }
public void CreatedFixtureSetIsUsedToCreateTestCommands( [Frozen] IExemplarFactory exemplarFactory, [Frozen] IFixtureSetFactory fixtureSetFactory, ParadigmTestClassCommand sut, IParadigmExemplar[] exemplars, IEnumerable<ITestCommand>[] createdCommands, IFixtureSet fixtureSet, IMethodInfo methodInfo) { Mock.Get(exemplarFactory).Setup(x => x.CreateExemplarsFor(sut.TypeUnderTest)) .Returns(exemplars); for (var i = 0; i < exemplars.Length; i++) { Mock.Get(exemplars[i]).Setup(x => x.CreateTestCommands(It.IsAny<IMethodInfo>(), fixtureSet)) .Returns(createdCommands[i]); } Mock.Get(fixtureSetFactory).Setup(x => x.CreateFixturesFor(sut.TypeUnderTest)) .Returns(fixtureSet); sut.ClassStart(); var commands = sut.EnumerateTestCommands(methodInfo); Assert.Equal(createdCommands.SelectMany(x => x), commands); }