public void ThrowsExactlyAssertPassWhenExceptionTypeIsEqualToExpected() { Should.NotThrow(() => BddScenario .Given <Fixture>() .GivenNoAction() .When(f => f.BusinessRuleWasBroken()) .Then().ThrowsExactly <BusinessException>() .Test()); }
public void ThrowsExactlyAssertFailWhenExceptionTypeIsNotEqualToExpected() { Should.Throw <AggregateAssertException>(() => BddScenario .Given <Fixture>() .GivenNoAction() .When(f => f.BusinessRuleWasBroken()) .Then().ThrowsExactly <Exception>() .Test()); }
public void ThrowsAssertFailWhenExceptionTypeIsNotAssignableToExpected() { Should.Throw <AggregateAssertException>(() => BddScenario .Given <Fixture>() .GivenNoAction() .When(f => f.BusinessRuleWasBroken()) .Then().Throws <InvalidOperationException>() .Test()); }
public void GivenActionsAreNotRequired() { var fixtureMock = new Mock <IFixture>(); BddScenario .Given(fixtureMock.Object) .GivenNoAction() .When(f => f.SomethingIsDone()) .Then(f => f.Result1IsAsExpected()) .Test(); }
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"); }