コード例 #1
0
        public async Task <IActionResult> Get([FromRoute] GetWorkOrderFromRoute route,
                                              [FromQuery] GetWorkOrderFromQuery query)
        {
            var request = new GetWorkOrderRequest(route, query);

            var result = await _apiResult.Produce(request);

            return(result);
        }
コード例 #2
0
        public void ConstructorShouldFailWhenQueryIsNull()
        {
            // Arrange
            var route = new GetWorkOrderFromRoute();
            GetWorkOrderFromQuery query = null;

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

            // Assert
            ctor.Should().Throw <ArgumentNullException>();
        }
コード例 #3
0
        public void ConstructorShouldSucceed()
        {
            // Arrange
            var route = new GetWorkOrderFromRoute();
            var query = new GetWorkOrderFromQuery();


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

            // Assert
            obj.Should().NotBeNull();
        }
コード例 #4
0
        public void MemberQueryApiVersionShouldHaveCorrectValue()
        {
            // Arrange
            var apiVersion = "1.0";
            var route      = new GetWorkOrderFromRoute();
            var query      = new GetWorkOrderFromQuery()
            {
                ApiVersion = apiVersion
            };

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

            // Assert
            obj.QueryApiVersion.Should().Be(apiVersion);
        }
コード例 #5
0
        public void MemberRouteIdShouldHaveCorrectValue()
        {
            // Arrange
            var routeId = Guid.NewGuid().ToString();
            var route   = new GetWorkOrderFromRoute()
            {
                Id = routeId
            };
            var query = new GetWorkOrderFromQuery();

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

            // Assert
            obj.RouteId.Should().Be(routeId);
        }
コード例 #6
0
 public GetWorkOrderRequest(GetWorkOrderFromRoute route, GetWorkOrderFromQuery query)
 {
     _route = route ?? throw new ArgumentNullException(nameof(route));
     _query = query ?? throw new ArgumentNullException(nameof(query));
 }