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

            BddScenario
            .Given(fixtureMock.Object)
            .GivenNoAction()
            .When(f => f.SomethingIsDone())
            .Then(f => f.Result1IsAsExpected())
            .Test();
        }
Exemple #5
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");
        }