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