public void DeleteColor_NonExistingId_ThrowsNullReferenceException()
        {
            Mock <IColorRepository> colorRepository = new Mock <IColorRepository>();
            ColorService            colorService    = new ColorService(colorRepository.Object);

            Action actual = () => colorService.Delete(1);

            Assert.Throws <NullReferenceException>(actual);
        }
Beispiel #2
0
        private static void DeleteColor(ColorService colorService)
        {
            var toDeleteColor = new Color {
                Id = 2
            };
            var result = colorService.Delete(toDeleteColor);

            Console.WriteLine(result.Message);
        }
        public ActionResult OnDelete(int id)
        {
            var result = ColorService.Delete(id);

            SetFlashMessage(result == Result.Ok ?
                            "Xóa màu sắc sản phẩm thành công." :
                            "Màu sắc sản phẩm không tồn tại trên hệ thống.");
            return(RedirectToAction("Index"));
        }