Exemplo n.º 1
0
        public async Task GetGenderCategories_Error()
        {
            var error                           = ErrorTransferData.ErrorBadRequest;
            var resultGenders                   = new ResultCollection <GenderCategoryTransfer>(error);
            var restClient                      = RestClientMock.GetRestClient(resultGenders);
            var genderTransferConverter         = GenderTransferConverterMock.GenderTransferConverter;
            var genderCategoryTransferConverter = GenderTransferConverterMock.GenderCategoryTransferConverter;
            var genderRestService               = new GenderRestService(restClient.Object, genderTransferConverter,
                                                                        genderCategoryTransferConverter);

            var result = await genderRestService.GetGenderCategories();

            Assert.True(result.HasErrors);
            Assert.True(result.Errors.First().ErrorResultType == ErrorResultType.BadRequest);
        }
Exemplo n.º 2
0
        public async Task GetGenderCategories_Ok()
        {
            var genders                         = GenderTransfersData.GenderCategoryTransfers;
            var resultGenders                   = new ResultCollection <GenderCategoryTransfer>(genders);
            var restClient                      = RestClientMock.GetRestClient(resultGenders);
            var genderTransferConverter         = GenderTransferConverterMock.GenderTransferConverter;
            var genderCategoryTransferConverter = GenderTransferConverterMock.GenderCategoryTransferConverter;
            var genderRestService               = new GenderRestService(restClient.Object, genderTransferConverter,
                                                                        genderCategoryTransferConverter);

            var result = await genderRestService.GetGenderCategories();

            var genderDomains = genderCategoryTransferConverter.FromTransfers(genders);

            Assert.True(result.OkStatus);
            Assert.True(result.Value.SequenceEqual(genderDomains.Value));
        }