public void MapClientResponseToRequest() { var mapper = new ApiLinkTypeModelMapper(); var model = new ApiLinkTypeClientResponseModel(); model.SetProperties(1, "A"); ApiLinkTypeClientRequestModel response = mapper.MapClientResponseToRequest(model); response.Should().NotBeNull(); response.RwType.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()); ApiLinkTypeClientResponseModel response = await client.LinkTypeGetAsync(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; ApiLinkTypeClientResponseModel response = await client.LinkTypeGetAsync(1); response.Should().NotBeNull(); response.Id.Should().Be(1); response.RwType.Should().Be("A"); }