Example #1
0
        public void EndpointMatchFilterNoMethodMatchTest()
        {
            #region TestSetup
            var faker       = new Faker();
            var httpMethods = new List <HttpMethod>
            {
                HttpMethod.Get,
                HttpMethod.Post,
                HttpMethod.Put,
                HttpMethod.Delete
            };
            var fakeScenario = scenarioFaker.Generate();

            var input = new
            {
                Scenarios = new List <Scenario>()
                {
                    fakeScenario
                },
                Path = fakeScenario.Path,
                Verb = faker.PickRandom(httpMethods.Where(method => !method.Equals(fakeScenario.Verb)))
            };
            #endregion
            var Target = new EndpointMatchFilter <ProcessMessagePort>();

            var Actual = Target.Process(new ProcessMessagePort {
                Scenarios = input.Scenarios, Path = input.Path, Verb = input.Verb
            }).Scenarios;

            Assert.Empty(Actual);
        }
Example #2
0
        public void EndpointMatchFilterSuccessTest()
        {
            #region TestSetup
            var fakeScenario = scenarioFaker.Generate();

            var input = new
            {
                Scenarios = new List <Scenario>()
                {
                    fakeScenario
                },
                Path = fakeScenario.Path,
                Verb = fakeScenario.Verb
            };
            #endregion
            var Target = new EndpointMatchFilter <ProcessMessagePort>();

            var Actual = Target.Process(new ProcessMessagePort {
                Scenarios = input.Scenarios, Path = input.Path, Verb = input.Verb
            }).Scenarios;
            var Expected = new List <Scenario> {
                fakeScenario
            };

            Assert.Equal(Expected, Actual);
        }
Example #3
0
        public void EndpointMatchFilterNoScenariosMatchTest()
        {
            #region TestSetup
            var faker = new Faker();

            var input = new
            {
                Scenarios = new List <Scenario>(),
                Path      = faker.Lorem.Word(),
                Verb      = HttpMethod.Get
            };
            #endregion
            var Target = new EndpointMatchFilter <ProcessMessagePort>();

            var Actual = Target.Process(new ProcessMessagePort {
                Scenarios = input.Scenarios, Path = input.Path, Verb = input.Verb
            }).Scenarios;

            Assert.Empty(Actual);
        }
Example #4
0
        public void EndpointMatchFilterNoPathMatchTest()
        {
            #region TestSetup
            var fakeScenario = scenarioFaker.Generate();

            var input = new
            {
                Scenarios = new List <Scenario>()
                {
                    fakeScenario
                },
                Path = fakeScenario.Path + "/diff",
                Verb = fakeScenario.Verb
            };
            #endregion
            var Target = new EndpointMatchFilter <ProcessMessagePort>();

            var Actual = Target.Process(new ProcessMessagePort {
                Scenarios = input.Scenarios, Path = input.Path, Verb = input.Verb
            }).Scenarios;

            Assert.Empty(Actual);
        }