Ejemplo n.º 1
0
        public async Task PostAsync_Error()
        {
            var test                  = TestData.TestDomains.First();
            var error                 = ErrorTransferData.ErrorBadRequest;
            var resultIds             = new ResultValue <string>(error);
            var restClient            = RestClientMock.PostRestClient(resultIds);
            var testTransferConverter = TestTransferConverter;
            var testRestService       = new TestRestService(restClient.Object, testTransferConverter);

            var result = await testRestService.PostAsync(test);

            Assert.True(result.HasErrors);
            Assert.True(result.Errors.First().ErrorResultType == ErrorResultType.BadRequest);
        }
Ejemplo n.º 2
0
        public async Task PostAsync_Ok()
        {
            var test                  = TestData.TestDomains.First();
            var testId                = test.Id;
            var resultId              = new ResultValue <string>(testId.ToString());
            var restClient            = RestClientMock.PostRestClient(resultId);
            var testTransferConverter = TestTransferConverter;
            var testRestService       = new TestRestService(restClient.Object, testTransferConverter);

            var result = await testRestService.PostAsync(test);

            Assert.True(result.OkStatus);
            Assert.True(result.Value.Equals(testId.ToString()));
        }