예제 #1
0
 public void ThrowsExactlyAssertFailWhenExceptionTypeIsNotEqualToExpected()
 {
     Should.Throw <AggregateAssertException>(() => BddScenario
                                             .Given <Fixture>()
                                             .GivenNoAction()
                                             .When(f => f.BusinessRuleWasBroken())
                                             .Then().ThrowsExactly <Exception>()
                                             .Test());
 }
예제 #2
0
 public void ThrowsExactlyAssertPassWhenExceptionTypeIsEqualToExpected()
 {
     Should.NotThrow(() => BddScenario
                     .Given <Fixture>()
                     .GivenNoAction()
                     .When(f => f.BusinessRuleWasBroken())
                     .Then().ThrowsExactly <BusinessException>()
                     .Test());
 }
예제 #3
0
 public void ThrowsAssertFailWhenExceptionTypeIsNotAssignableToExpected()
 {
     Should.Throw <AggregateAssertException>(() => BddScenario
                                             .Given <Fixture>()
                                             .GivenNoAction()
                                             .When(f => f.BusinessRuleWasBroken())
                                             .Then().Throws <InvalidOperationException>()
                                             .Test());
 }
예제 #4
0
        public void GivenActionsAreNotRequired()
        {
            var fixtureMock = new Mock <IFixture>();

            BddScenario
            .Given(fixtureMock.Object)
            .GivenNoAction()
            .When(f => f.SomethingIsDone())
            .Then(f => f.Result1IsAsExpected())
            .Test();
        }
예제 #5
0
 private static IBddScenario CreateScenario(IFixture fixture, string title = null)
 {
     return(BddScenario
            .Title(title)
            .Given(fixture)
            .Given(f => f.FirstFact())
            .And(f => f.SecondFact())
            .When(f => f.SomethingIsDone())
            .Then(f => f.Result1IsAsExpected())
            .And(f => f.Result2IsAsExpected())
            .Create());
 }
예제 #6
0
        public void DefaultTitleIsEqualToHumanizedMethodName()
        {
            var          fixtureMock = new Mock <IFixture>();
            IBddScenario scenario    = BddScenario
                                       .Given(fixtureMock.Object)
                                       .Given(f => f.FirstFact())
                                       .And(f => f.SecondFact())
                                       .When(f => f.SomethingIsDone())
                                       .Then(f => f.Result1IsAsExpected())
                                       .And(f => f.Result2IsAsExpected())
                                       .Create();

            scenario.GetDescription().Title.ShouldBe("Default title is equal to humanized method name");
        }