public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiAdminModelMapper mapper = new ApiAdminModelMapper();

            UpdateResponse <ApiAdminResponseModel> updateResponse = await this.Client.AdminUpdateAsync(model.Id, mapper.MapResponseToRequest(model));

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

            await this.Cleanup();
        }
Beispiel #2
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiAdminModelMapper();
            var model  = new ApiAdminResponseModel();

            model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A", "A", "A", "A", 1);
            ApiAdminRequestModel response = mapper.MapResponseToRequest(model);

            response.Birthday.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Email.Should().Be("A");
            response.FirstName.Should().Be("A");
            response.LastName.Should().Be("A");
            response.Phone.Should().Be("A");
            response.StudioId.Should().Be(1);
        }
        public void MapResponseToRequest()
        {
            var mapper = new ApiAdminModelMapper();
            var model  = new ApiAdminResponseModel();

            model.SetProperties(1, "A", "A", "A", "A", "A", "A");
            ApiAdminRequestModel response = mapper.MapResponseToRequest(model);

            response.Email.Should().Be("A");
            response.FirstName.Should().Be("A");
            response.LastName.Should().Be("A");
            response.Password.Should().Be("A");
            response.Phone.Should().Be("A");
            response.Username.Should().Be("A");
        }
        public void MapClientRequestToResponse()
        {
            var mapper = new ApiAdminModelMapper();
            var model  = new ApiAdminClientRequestModel();

            model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), "A", "A", "A", "A", 1);
            ApiAdminClientResponseModel response = mapper.MapClientRequestToResponse(1, model);

            response.Should().NotBeNull();
            response.Birthday.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Email.Should().Be("A");
            response.FirstName.Should().Be("A");
            response.LastName.Should().Be("A");
            response.Phone.Should().Be("A");
            response.UserId.Should().Be(1);
        }
Beispiel #5
0
        public void CreatePatch()
        {
            var mapper = new ApiAdminModelMapper();
            var model  = new ApiAdminRequestModel();

            model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), "A", "A", "A", "A", 1);

            JsonPatchDocument <ApiAdminRequestModel> patch = mapper.CreatePatch(model);
            var response = new ApiAdminRequestModel();

            patch.ApplyTo(response);
            response.Birthday.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Email.Should().Be("A");
            response.FirstName.Should().Be("A");
            response.LastName.Should().Be("A");
            response.Phone.Should().Be("A");
            response.StudioId.Should().Be(1);
        }
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            ApiAdminResponseModel model = await client.AdminGetAsync(1);

            ApiAdminModelMapper mapper = new ApiAdminModelMapper();

            UpdateResponse <ApiAdminResponseModel> updateResponse = await client.AdminUpdateAsync(model.Id, mapper.MapResponseToRequest(model));

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
        }
        public void CreatePatch()
        {
            var mapper = new ApiAdminModelMapper();
            var model  = new ApiAdminRequestModel();

            model.SetProperties("A", "A", "A", "A", "A", "A");

            JsonPatchDocument <ApiAdminRequestModel> patch = mapper.CreatePatch(model);
            var response = new ApiAdminRequestModel();

            patch.ApplyTo(response);
            response.Email.Should().Be("A");
            response.FirstName.Should().Be("A");
            response.LastName.Should().Be("A");
            response.Password.Should().Be("A");
            response.Phone.Should().Be("A");
            response.Username.Should().Be("A");
        }