Ejemplo n.º 1
0
        public async void IsBadRequestObjectResultCreateShopAsync()
        {
            // Arrange
            ShopController controller = new ShopController(mockShopService.Object);

            // Act
            controller.ModelState.AddModelError("Title", "Title is require value");
            var result = await controller.Create(await ShopTestHelper.GetShopCreateUnNormal());

            // Assert
            Assert.IsType <BadRequestObjectResult>(result);
        }
Ejemplo n.º 2
0
        public async Task Shop_Ok_Create()
        {
            var shopModel = Model();

            var mockShop = new Mock <IShopService>();

            var controller = new ShopController(mockShop.Object, null, null);

            var result = await controller.Create(shopModel);

            var actionResult = Assert.IsType <OkResult>(result);
        }
Ejemplo n.º 3
0
        public async Task CreateShopTestAsync()
        {
            // Arrange
            Mock <ShopEntity> mockShop   = new Mock <ShopEntity>();
            ShopController    controller = new ShopController(mockShopService.Object);

            // Act
            var result = await controller.Create(await ShopTestHelper.GetShopCreateNormal());

            var okResult = Assert.IsType <OkObjectResult>(result);

            // Assert
            Assert.IsType <OkObjectResult>(result);
            mockShopService.Verify(
                mock => mock.CreateShop(mockShop.Object), Times.Never());
        }