public StaticCommandLineRouterFixture()
 {
     WithRouteCommandParser  = new RouteCommandsParser(SerilogFixture.UsefullLogger <RouteCommandsParser>());
     WithRouteOptionsParser  = new RouteOptionsParser(SerilogFixture.UsefullLogger <RouteOptionsParser>());
     WithRouteRequestBuilder = new RouteRequestBuilder(SerilogFixture.UsefullLogger <RouteRequestBuilder>());
     WithRouteValidator      = new RouteRequestValidatorFixture().Build();
 }
Beispiel #2
0
        public void ParseAndPopulateOptions_HappyPath(Noun expectedNoun, Noun inputNoun, string commandLine)
        {
            // remember : inputNoun is partially pre-populated; ParseAndPopulateOptions is to fill in the
            // values for any options that have been defined.

            var sut = new RouteOptionsParser(SerilogFixture.UsefullLogger <RouteOptionsParser>());

            sut.ParseAndPopulateOptions(ref inputNoun, commandLine.Split(' '));
            inputNoun.Should().NotBeNull();
            inputNoun.Verbs.Should().HaveCount(1);
            inputNoun.Verbs.Single().Value.Should().NotBeNull();

            var expectedOptions = expectedNoun.Verbs.Single().Value.Options;
            var actualOptions   = inputNoun.Verbs.Single().Value.Options;

            actualOptions.Keys.Should().Contain(expectedOptions.Keys);

            foreach (var currentKey in expectedOptions.Keys)
            {
                var currentExpectedOption = expectedOptions[currentKey];
                var currentActualOption   = actualOptions[currentKey];

                currentActualOption.Should().BeEquivalentTo(currentExpectedOption);
            }
        }