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()); ApiCustomerClientResponseModel response = await client.CustomerGetAsync(default(int)); response.Should().BeNull(); }
public void MapClientRequestToResponse() { var mapper = new ApiCustomerModelMapper(); var model = new ApiCustomerClientRequestModel(); model.SetProperties("A", "A", "A", "A"); ApiCustomerClientResponseModel response = mapper.MapClientRequestToResponse(1, model); response.Should().NotBeNull(); response.Email.Should().Be("A"); response.FirstName.Should().Be("A"); response.LastName.Should().Be("A"); response.Phone.Should().Be("A"); }
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; ApiCustomerClientResponseModel response = await client.CustomerGetAsync(1); response.Should().NotBeNull(); response.Email.Should().Be("A"); response.FirstName.Should().Be("A"); response.Id.Should().Be(1); response.LastName.Should().Be("A"); response.Phone.Should().Be("A"); }