Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AdditionSpecification
- {
- static int result;
- public void Because()
- {
- result = 2 + 2;
- }
- public void Result_is_non_zero()
- {
- Assert.True(result <> 0);
- }
- public void Result_is_correct()
- {
- Assert.Equal(4, result);
- }
- }
- public class AdditionFixture : IDisposable
- {
- public int Because()
- {
- return 2 + 2;
- }
- public void Dispose()
- {
- //test tear down code
- }
- }
- public class AdditionSpecification : IUseFixture<AdditionFixture>
- {
- int result;
- public void SetFixture(AdditionFixture Fixture)
- {
- result = Fixture.Because();
- }
- [Fact]
- public void Result_is_non_zero()
- {
- Assert.True(result <> 0);
- }
- [Fact]
- public void Result_is_correct()
- {
- Assert.Equal(4, result);
- }
- }
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
- public class RunWithMyTestClassCommandAttribute : RunWithAttribute
- {
- public RunWithMyTestClassCommandAttribute()
- : base(typeof(MyTestClassCommand)) {}
- }
- [RunWithMyTestClassCommand]
- public class AdditionSpecification
- {
- static int result;
- public void Because()
- {
- result = 2 + 2;
- }
- public void Result_is_non_zero()
- {
- Assert.True(result <> 0);
- }
- public void Result_is_correct()
- {
- Assert.Equal(4, result);
- }
- }
Add Comment
Please, Sign In to add comment