示例#1
0
        public void ThenSectionTextIsCorrect()
        {
            var          fixtureMock = new Mock <IFixture>();
            IBddScenario scenario    = CreateScenario(fixtureMock.Object);

            scenario.GetDescription().Then.ShouldBe($"Then result 1 is as expected{Environment.NewLine}\tAnd result 2 is as expected");
        }
示例#2
0
        public void WhenSectionTextIsCorrect()
        {
            var          fixtureMock = new Mock <IFixture>();
            IBddScenario scenario    = CreateScenario(fixtureMock.Object);

            scenario.GetDescription().When.ShouldBe("When something is done");
        }
示例#3
0
        public void GivenSectionTextIsCorrect()
        {
            var          fixtureMock = new Mock <IFixture>();
            IBddScenario scenario    = CreateScenario(fixtureMock.Object);

            scenario.GetDescription().Given.ShouldBe($"Given first fact{Environment.NewLine}\tAnd second fact");
        }
示例#4
0
        public void CustomTitleIsCorrect()
        {
            var          fixtureMock = new Mock <IFixture>();
            const string title       = "Custom title";
            IBddScenario scenario    = CreateScenario(fixtureMock.Object, title);

            scenario.GetDescription().Title.ShouldBe(title);
        }
示例#5
0
        public void DescriptionIsCorrectlyComposedFromSections()
        {
            var          fixtureMock = new Mock <IFixture>();
            IBddScenario scenario    = CreateScenario(fixtureMock.Object);

            IBddScenarioDescription description = scenario.GetDescription();
            string newLine = Environment.NewLine;

            description.ToString().ShouldBe($"{description.Title}{newLine}{description.Given}{newLine}{description.When}{newLine}{description.Then}{newLine}");
        }
示例#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");
        }