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

            ApiPasswordModelMapper mapper = new ApiPasswordModelMapper();

            UpdateResponse <ApiPasswordResponseModel> updateResponse = await this.Client.PasswordUpdateAsync(model.BusinessEntityID, mapper.MapResponseToRequest(model));

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

            await this.Cleanup();
        }
        public void MapResponseToRequest()
        {
            var mapper = new ApiPasswordModelMapper();
            var model  = new ApiPasswordResponseModel();

            model.SetProperties(1, DateTime.Parse("1/1/1987 12:00:00 AM"), "A", "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            ApiPasswordRequestModel response = mapper.MapResponseToRequest(model);

            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.PasswordHash.Should().Be("A");
            response.PasswordSalt.Should().Be("A");
            response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
        }
        public void CreatePatch()
        {
            var mapper = new ApiPasswordModelMapper();
            var model  = new ApiPasswordRequestModel();

            model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), "A", "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));

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

            patch.ApplyTo(response);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.PasswordHash.Should().Be("A");
            response.PasswordSalt.Should().Be("A");
            response.Rowguid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
        }
Пример #4
0
        public async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

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

            ApiPasswordResponseModel model = await client.PasswordGetAsync(1);

            ApiPasswordModelMapper mapper = new ApiPasswordModelMapper();

            UpdateResponse <ApiPasswordResponseModel> updateResponse = await client.PasswordUpdateAsync(model.BusinessEntityID, mapper.MapResponseToRequest(model));

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