public void CreateTestsForMethodWithoutFirstClassTestsThrows() { var method = Reflector.Wrap(this.GetType().GetMethod( "VoidTests", BindingFlags.Static | BindingFlags.NonPublic)); var sut = new FirstClassTestsAttribute(); Assert.Throws<ArgumentException>( () => sut.CreateTestCommands(method)); }
public void CreateTestMethodWithFirstClassTestsReturnsCorrectResult() { var method = Reflector.Wrap(this.GetType().GetMethod( "CreateFirstClassTests", BindingFlags.Static | BindingFlags.NonPublic)); var sut = new FirstClassTestsAttribute(); var actual = sut.CreateTestCommands(method); Assert.Equal( 3, actual.OfType<FirstClassCommand>().Count()); Assert.True( actual .OfType<FirstClassCommand>() .All(fcc => fcc.TestAction.Method.DeclaringType == this.GetType()), "All test actions should be declared here."); }
public void SutIsFactAttribute() { var sut = new FirstClassTestsAttribute(); Assert.IsAssignableFrom<FactAttribute>(sut); }
public void CreateTestCommandsForNullMethodThrows() { var sut = new FirstClassTestsAttribute(); Assert.Throws<ArgumentNullException>( () => sut.CreateTestCommands(null)); }