Example #1
0
        public void TestFileReader_LoadsFileWithCustomKeywords_ParsesCustomKeywords()
        {
            TestFileReader testReader = new TestFileReader(fileService);

            testReader.LoadFile("my test");
            var keywords = testReader.GetKeywords();

            keywords.Should().HaveCount(2);
            keywords[0].Keyword.Should().Be("Start and login");
            keywords[0].Inputs[0].Should().Be("user");
            keywords[0].Inputs[1].Should().Be("password");

            keywords.First(k => k.Keyword == "Start and login").Steps[0].Keyword.Should().Be("Start app");
            keywords.First(k => k.Keyword == "Start and login")
            .Steps.First(s => s.Keyword == "Start app")
            .Inputs.Should().HaveCount(0);
            keywords.First(k => k.Keyword == "Start and login").Steps[1].Keyword.Should().Be("Login");
            keywords.First(k => k.Keyword == "Start and login")
            .Steps.First(s => s.Keyword == "Login")
            .Inputs.Should().HaveCount(2);
            keywords[0].Steps[1].Inputs["user"].Should().Be("${user}");
            keywords[0].Steps[1].Inputs["password"].Should().Be("${password}");

            keywords[1].Keyword.Should().Be("Close app");
            keywords.First(k => k.Keyword == "Close app").Steps.Should().HaveCount(2);
            keywords.First(k => k.Keyword == "Close app").Steps[1].Keyword.Should().Be("Exit");
            keywords.First(k => k.Keyword == "Close app")
            .Steps.First(s => s.Keyword == "Exit")
            .Inputs.Should().HaveCount(0);
        }