Ejemplo n.º 1
0
        public async Task <IActionResult> Get([FromRoute] GetFromRoute route,
                                              [FromQuery] GetFromQuery query)
        {
            var request = new GetRequest(route, query);

            var result = await _apiResult.Produce(request);

            return(result);
        }
Ejemplo n.º 2
0
        public void ConstructorShouldFailWhenQueryIsNull()
        {
            // Arrange
            var          route = new GetFromRoute();
            GetFromQuery query = null;

            // Act
            Action ctor = () => { new GetRequest(route, query); };

            // Assert
            ctor.Should().Throw <ArgumentNullException>();
        }
Ejemplo n.º 3
0
        public void ConstructorShouldSucceed()
        {
            // Arrange
            var route = new GetFromRoute();
            var query = new GetFromQuery();


            // Act
            var obj = new GetRequest(route, query);

            // Assert
            obj.Should().NotBeNull();
        }
Ejemplo n.º 4
0
        public void MemberQueryApiVersionShouldHaveCorrectValue()
        {
            // Arrange
            var apiVersion = "1.0";
            var route      = new GetFromRoute();
            var query      = new GetFromQuery()
            {
                ApiVersion = apiVersion
            };

            // Act
            var obj = new GetRequest(route, query);

            // Assert
            obj.QueryApiVersion.Should().Be(apiVersion);
        }
Ejemplo n.º 5
0
        public void MemberRouteIdShouldHaveCorrectValue()
        {
            // Arrange
            var routeId = Guid.NewGuid().ToString();
            var route   = new GetFromRoute()
            {
                Id = routeId
            };
            var query = new GetFromQuery();

            // Act
            var obj = new GetRequest(route, query);

            // Assert
            obj.RouteId.Should().Be(routeId);
        }
Ejemplo n.º 6
0
 public GetRequest(GetFromRoute route, GetFromQuery query)
 {
     _route = route ?? throw new ArgumentNullException(nameof(route));
     _query = query ?? throw new ArgumentNullException(nameof(query));
 }