public virtual async void TestBulkInsert()
        {
            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;

            var model = new ApiLinkStatusClientRequestModel();

            model.SetProperties("B");
            var model2 = new ApiLinkStatusClientRequestModel();

            model2.SetProperties("C");
            var request = new List <ApiLinkStatusClientRequestModel>()
            {
                model, model2
            };
            CreateResponse <List <ApiLinkStatusClientResponseModel> > result = await client.LinkStatusBulkInsertAsync(request);

            result.Success.Should().BeTrue();
            result.Record.Should().NotBeNull();

            context.Set <LinkStatus>().ToList()[1].Name.Should().Be("B");

            context.Set <LinkStatus>().ToList()[2].Name.Should().Be("C");
        }
        public virtual ApiLinkStatusClientRequestModel MapServerResponseToClientRequest(
            ApiLinkStatusServerResponseModel response)
        {
            var request = new ApiLinkStatusClientRequestModel();

            request.SetProperties(
                response.Name);
            return(request);
        }
Ejemplo n.º 3
0
        public void MapClientResponseToRequest()
        {
            var mapper = new ApiLinkStatusModelMapper();
            var model  = new ApiLinkStatusClientResponseModel();

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

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