public void MapClientRequestToResponse() { var mapper = new ApiPersonModelMapper(); var model = new ApiPersonClientRequestModel(); model.SetProperties("A"); ApiPersonClientResponseModel response = mapper.MapClientRequestToResponse(1, model); response.Should().NotBeNull(); response.PersonName.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()); ApiPersonClientResponseModel response = await client.PersonGetAsync(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; ApiPersonClientResponseModel response = await client.PersonGetAsync(1); response.Should().NotBeNull(); response.PersonId.Should().Be(1); response.PersonName.Should().Be("A"); }