Пример #1
0
        public async void TestUpdate()
        {
            var model = await this.CreateRecord();

            ApiMachineModelMapper mapper = new ApiMachineModelMapper();

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

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

            await this.Cleanup();
        }
Пример #2
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiMachineModelMapper();
            var model  = new ApiMachineResponseModel();

            model.SetProperties(1, "A", "A", "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), "A");
            ApiMachineRequestModel response = mapper.MapResponseToRequest(model);

            response.Description.Should().Be("A");
            response.JwtKey.Should().Be("A");
            response.LastIpAddress.Should().Be("A");
            response.MachineGuid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            response.Name.Should().Be("A");
        }
Пример #3
0
        public void CreatePatch()
        {
            var mapper = new ApiMachineModelMapper();
            var model  = new ApiMachineRequestModel();

            model.SetProperties("A", "A", "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), "A");

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

            patch.ApplyTo(response);
            response.Description.Should().Be("A");
            response.JwtKey.Should().Be("A");
            response.LastIpAddress.Should().Be("A");
            response.MachineGuid.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            response.Name.Should().Be("A");
        }
Пример #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());

            ApiMachineResponseModel model = await client.MachineGetAsync(1);

            ApiMachineModelMapper mapper = new ApiMachineModelMapper();

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

            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
        }
Пример #5
0
        public void MapResponseToRequest()
        {
            var mapper = new ApiMachineModelMapper();
            var model  = new ApiMachineResponseModel();

            model.SetProperties("A", "A", "A", "A", true, "A", "A", "A", "A", "A", "A", "A", "A");
            ApiMachineRequestModel response = mapper.MapResponseToRequest(model);

            response.CommunicationStyle.Should().Be("A");
            response.EnvironmentIds.Should().Be("A");
            response.Fingerprint.Should().Be("A");
            response.IsDisabled.Should().Be(true);
            response.JSON.Should().Be("A");
            response.MachinePolicyId.Should().Be("A");
            response.Name.Should().Be("A");
            response.RelatedDocumentIds.Should().Be("A");
            response.Roles.Should().Be("A");
            response.TenantIds.Should().Be("A");
            response.TenantTags.Should().Be("A");
            response.Thumbprint.Should().Be("A");
        }
Пример #6
0
        public void CreatePatch()
        {
            var mapper = new ApiMachineModelMapper();
            var model  = new ApiMachineRequestModel();

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

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

            patch.ApplyTo(response);
            response.CommunicationStyle.Should().Be("A");
            response.EnvironmentIds.Should().Be("A");
            response.Fingerprint.Should().Be("A");
            response.IsDisabled.Should().Be(true);
            response.JSON.Should().Be("A");
            response.MachinePolicyId.Should().Be("A");
            response.Name.Should().Be("A");
            response.RelatedDocumentIds.Should().Be("A");
            response.Roles.Should().Be("A");
            response.TenantIds.Should().Be("A");
            response.TenantTags.Should().Be("A");
            response.Thumbprint.Should().Be("A");
        }