예제 #1
0
        public void Put_async_should_add_route()
        {
            // given
            var module = new ArgolisModuleTestable(this.templateProvider);

            // when
            module.Put <object>(_ => Task.FromResult(new object()));

            // then
            module.Routes.Single().Description.Method.Should().Be("PUT");
        }
예제 #2
0
        public void Get_async_with_token_should_add_route()
        {
            // given
            var module = new ArgolisModuleTestable(this.templateProvider);

            // when
            module.Get <object>((_, c) => null);

            // then
            module.Routes.Single().Description.Method.Should().Be("GET");
        }
예제 #3
0
        public void Head_sync_should_add_route()
        {
            // given
            var module = new ArgolisModuleTestable(this.templateProvider);

            // when
            module.Head <object>(_ => new object());

            // then
            module.Routes.Single().Description.Method.Should().Be("HEAD");
        }
예제 #4
0
        public void Get_route_should_add_correct_route_entry()
        {
            // given
            var module = new ArgolisModuleTestable(this.templateProvider);

            // when
            module.Get <object>(_ => new object(), context => true, "TestRoute");
            module.Get <object>((_, c) => Task.FromResult(new object()), context => true, "TestRoute");
            module.Get <object>(_ => Task.FromResult(new object()), context => true, "TestRoute");

            // then
            foreach (var route in module.Routes)
            {
                var description = route.Description;

                description.Condition.Should().NotBeNull();
                description.Name.Should().Be("TestRoute");
                description.Path.Should().Be(TestTemplate);
            }
        }