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); }
public void ConstructorShouldFailWhenQueryIsNull() { // Arrange var route = new GetWorkOrderFromRoute(); GetWorkOrderFromQuery query = null; // Act Action ctor = () => { new GetWorkOrderRequest(route, query); }; // Assert ctor.Should().Throw <ArgumentNullException>(); }
public void ConstructorShouldSucceed() { // Arrange var route = new GetWorkOrderFromRoute(); var query = new GetWorkOrderFromQuery(); // Act var obj = new GetWorkOrderRequest(route, query); // Assert obj.Should().NotBeNull(); }
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); }
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); }
public GetWorkOrderRequest(GetWorkOrderFromRoute route, GetWorkOrderFromQuery query) { _route = route ?? throw new ArgumentNullException(nameof(route)); _query = query ?? throw new ArgumentNullException(nameof(query)); }