Exemple #1
0
        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 ApiFileRequestModel();

            createModel.SetProperties(1, DateTime.Parse("1/1/1988 12:00:00 AM"), "B", DateTime.Parse("1/1/1988 12:00:00 AM"), "B", Guid.Parse("3842cac4-b9a0-8223-0dcc-509a6f75849b"), 2, 1, "B", "B", "B");
            CreateResponse <ApiFileResponseModel> createResult = await client.FileCreateAsync(createModel);

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

            ApiFileResponseModel getResponse = await client.FileGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.FileDeleteAsync(2);

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

            ApiFileResponseModel verifyResponse = await client.FileGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Exemple #2
0
        private async Task <ApiFileResponseModel> CreateRecord(ApiClient client)
        {
            var model = new ApiFileRequestModel();

            model.SetProperties(1, DateTime.Parse("1/1/1988 12:00:00 AM"), "B", DateTime.Parse("1/1/1988 12:00:00 AM"), "B", Guid.Parse("3842cac4-b9a0-8223-0dcc-509a6f75849b"), 2, 1, "B", "B", "B");
            CreateResponse <ApiFileResponseModel> result = await client.FileCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
Exemple #3
0
        public void MapModelToBO()
        {
            var mapper = new BOLFileMapper();
            ApiFileRequestModel model = new ApiFileRequestModel();

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

            response.BucketId.Should().Be(1);
            response.DateCreated.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Description.Should().Be("A");
            response.Expiration.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Extension.Should().Be("A");
            response.ExternalId.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            response.FileSizeInBytes.Should().Be(1m);
            response.FileTypeId.Should().Be(1);
            response.Location.Should().Be("A");
            response.PrivateKey.Should().Be("A");
            response.PublicKey.Should().Be("A");
        }
        public void CreatePatch()
        {
            var mapper = new ApiFileModelMapper();
            var model  = new ApiFileRequestModel();

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

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

            patch.ApplyTo(response);
            response.BucketId.Should().Be(1);
            response.DateCreated.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Description.Should().Be("A");
            response.Expiration.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Extension.Should().Be("A");
            response.ExternalId.Should().Be(Guid.Parse("8420cdcf-d595-ef65-66e7-dff9f98764da"));
            response.FileSizeInByte.Should().Be(1);
            response.FileTypeId.Should().Be(1);
            response.Location.Should().Be("A");
            response.PrivateKey.Should().Be("A");
            response.PublicKey.Should().Be("A");
        }