コード例 #1
0
        public void MapClientResponseToRequest()
        {
            var mapper = new ApiCallStatusModelMapper();
            var model  = new ApiCallStatusClientResponseModel();

            model.SetProperties(1, "A");
            ApiCallStatusClientRequestModel response = mapper.MapClientResponseToRequest(model);

            response.Should().NotBeNull();
            response.Name.Should().Be("A");
        }
コード例 #2
0
        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());
            ApiCallStatusClientResponseModel response = await client.CallStatusGetAsync(default(int));

            response.Should().BeNull();
        }
コード例 #3
0
        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;

            ApiCallStatusClientResponseModel response = await client.CallStatusGetAsync(1);

            response.Should().NotBeNull();
            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }