public async void TestDelete()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

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

            var createModel = new ApiMachineRequestModel();

            createModel.SetProperties("B", "B", "B", Guid.Parse("3842cac4-b9a0-8223-0dcc-509a6f75849b"), "B");
            CreateResponse <ApiMachineResponseModel> createResult = await client.MachineCreateAsync(createModel);

            createResult.Success.Should().BeTrue();

            ApiMachineResponseModel getResponse = await client.MachineGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.MachineDeleteAsync(2);

            deleteResult.Success.Should().BeTrue();

            ApiMachineResponseModel verifyResponse = await client.MachineGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Exemple #2
0
        private async Task <ApiMachineResponseModel> CreateRecord()
        {
            var model = new ApiMachineRequestModel();

            model.SetProperties("B", "B", "B", true, "B", "B", "B", "B", "B", "B", "B", "B");
            CreateResponse <ApiMachineResponseModel> result = await this.Client.MachineCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
        private async Task <ApiMachineResponseModel> CreateRecord()
        {
            var model = new ApiMachineRequestModel();

            model.SetProperties("B", "B", "B", Guid.Parse("3842cac4-b9a0-8223-0dcc-509a6f75849b"), "B");
            CreateResponse <ApiMachineResponseModel> result = await this.Client.MachineCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
        public void MapModelToBO()
        {
            var mapper = new BOLMachineMapper();
            ApiMachineRequestModel model = new ApiMachineRequestModel();

            model.SetProperties("A", "A", "A", Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"), "A");
            BOMachine response = mapper.MapModelToBO(1, 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");
        }
        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");
        }
        public void MapModelToBO()
        {
            var mapper = new BOLMachineMapper();
            ApiMachineRequestModel model = new ApiMachineRequestModel();

            model.SetProperties("A", "A", "A", true, "A", "A", "A", "A", "A", "A", "A", "A");
            BOMachine response = mapper.MapModelToBO("A", 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");
        }
Exemple #7
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");
        }