public void MapClientResponseToRequest() { var mapper = new ApiDeviceActionModelMapper(); var model = new ApiDeviceActionClientResponseModel(); model.SetProperties(1, "A", 1, "A"); ApiDeviceActionClientRequestModel response = mapper.MapClientResponseToRequest(model); response.Should().NotBeNull(); response.Action.Should().Be("A"); response.DeviceId.Should().Be(1); response.Name.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()); ApiDeviceActionClientResponseModel response = await client.DeviceActionGetAsync(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; ApiDeviceActionClientResponseModel response = await client.DeviceActionGetAsync(1); response.Should().NotBeNull(); response.Action.Should().Be("A"); response.DeviceId.Should().Be(1); response.Id.Should().Be(1); response.Name.Should().Be("A"); }