Esempio n. 1
0
        public async Task TestGetServicesByIdAsync()
        {
            var dbContext  = DbContextMock.GetDbContext(nameof(TestGetServicesByIdAsync));
            var controller = new ServiceController(dbContext);

            var response = await controller.GetServiceByIdAsync(1) as ObjectResult;

            var value = response.Value as ISingleResponse <Service>;

            Assert.False(value.DidError);
        }
        public async Task TestGetCountriesAsync()
        {
            var dbContext  = DbContextMock.GetDbContext(nameof(TestGetCountriesAsync));
            var controller = new CountryController(dbContext);

            var response = await controller.GetCountriesAsync("") as ObjectResult;

            var value = response.Value as IPagedResponse <Country>;

            Assert.False(value.DidError);
        }
        public async Task TestPostCountryAsync()
        {
            var dbContext  = DbContextMock.GetDbContext(nameof(TestPostCountryAsync));
            var controller = new CountryController(dbContext);

            var country = new Country
            {
                Name = "USA"
            };

            var response = await controller.PostCountryAsync(country) as ObjectResult;

            var value = response.Value as ISingleResponse <Country>;

            Assert.False(value.DidError);
        }
Esempio n. 4
0
        public async Task TestPostServiceAsync()
        {
            var dbContext  = DbContextMock.GetDbContext(nameof(TestPostServiceAsync));
            var controller = new ServiceController(dbContext);

            var Service = new Service
            {
                Id    = 0,
                Name  = "Mi Service nuevo de prueba",
                Price = 20000,
            };

            var response = await controller.PostServiceAsync(Service) as ObjectResult;

            var value = response.Value as ISingleResponse <Service>;

            Assert.False(value.DidError);
        }
Esempio n. 5
0
        public async Task TestPutServiceAsync()
        {
            var dbContext  = DbContextMock.GetDbContext(nameof(TestPutServiceAsync));
            var controller = new ServiceController(dbContext);

            var Service = new Service
            {
                Id    = 1,
                Name  = "Mi Servicee nuevo de prueba modificado",
                Price = 500.0
            };


            var response = await controller.PutServiceAsync(1, Service) as ObjectResult;

            var value = response.Value as IResponse;

            Assert.False(value.DidError);
        }