コード例 #1
0
        public async void DeleteStoreWithIncorrectIdWillReturnNotFound()
        {
            var mapper = Helper.CreateMapperWithProfile <StoreProfile>();
            var store  = CreateRandomStore();
            var mock   = new Mock <IStoreRepository>();

            var service    = new StoreService(mock.Object, mapper);
            var controller = new StoresController(service);

            var response = await controller.DeleteById(store.StoreId);

            Assert.IsType <NotFoundResult>(response.Result);
        }
コード例 #2
0
        public async void UserCanDeleteStoreById()
        {
            var store = CreateRandomStore();
            var mock  = new Mock <IStoreService>();

            mock.Setup(x => x.FindByIdAsync(store.StoreId)).ReturnsAsync(store);

            var controller = new StoresController(mock.Object);

            var response = await controller.DeleteById(store.StoreId);

            Assert.IsType <OkObjectResult>(response.Result);
        }