public void MapClientRequestToResponse() { var mapper = new ApiLocationModelMapper(); var model = new ApiLocationClientRequestModel(); model.SetProperties(1, 1, "A"); ApiLocationClientResponseModel response = mapper.MapClientRequestToResponse(1, model); response.Should().NotBeNull(); response.GpsLat.Should().Be(1); response.GpsLong.Should().Be(1); response.LocationName.Should().Be("A"); }
public virtual async void TestGetNotFound() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); ApiLocationClientResponseModel response = await client.LocationGetAsync(default(int)); response.Should().BeNull(); }
public virtual async void TestGetFound() { var builder = new WebHostBuilder() .UseEnvironment("Production") .UseStartup <TestStartup>(); TestServer testServer = new TestServer(builder); var client = new ApiClient(testServer.CreateClient()); client.SetBearerToken(JWTTestHelper.GenerateBearerToken()); ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext; ApiLocationClientResponseModel response = await client.LocationGetAsync(1); response.Should().NotBeNull(); response.GpsLat.Should().Be(1); response.GpsLong.Should().Be(1); response.LocationId.Should().Be(1); response.LocationName.Should().Be("A"); }