Example #1
0
        public void Color_Create_WithIdDublicate_ThrowExeption()
        {
            IService <Color> colorService   = new ColorService();
            Color            newColorFirst  = new Color(1000, "First");
            Color            newColorSecond = new Color(1000, "Second");

            colorService.Create(newColorFirst);
            colorService.Create(newColorSecond);
        }
Example #2
0
        public void Color_Create_WithIdNotNull_True()
        {
            IService <Color> colorService = new ColorService();
            int   countBefore             = colorService.GetListAll().Count;
            Color newColor = new Color(999, "Vitalic");

            colorService.Create(newColor);
            int countAfter = colorService.GetListAll().Count;

            Assert.AreNotEqual(countBefore, countAfter);
        }
Example #3
0
        public void Color_DeleteById_WithIdNotNull_True()
        {
            IService <Color> colorService = new ColorService();
            Color            newColor     = new Color(1004, "Vitalic");

            colorService.Create(newColor);
            int countBefore = colorService.GetListAll().Count;

            colorService.DeleteById(1004);
            int countAfter = colorService.GetListAll().Count;

            Assert.IsTrue(countBefore > countAfter);
        }
Example #4
0
        public void Color_Update_WithIdNotNull_True()
        {
            IService <Color> colorService = new ColorService();
            Color            newColor     = new Color(1003, "Vitalic333");

            colorService.Create(newColor);
            Color crColor  = colorService.GetById(333);
            Color modColor = new Color(1003, "Vitalic1333");

            colorService.Update(modColor);
            Color updColor = colorService.GetById(1003);

            Assert.AreEqual(crColor.id, updColor.id);
            Assert.AreNotEqual(crColor.color, updColor.color);
        }
Example #5
0
        static void Main(string[] args)
        {
            IService <Color> colorService = new ColorService();

            Color newColor = new Color(33, "Vitalic");
            //colorService.Create(newColor);

            //colorService.DeleteById(0);

            Color dsdsf = new Color(33, "555");
            //colorService.Update(dsdsf);

            var listColorsById = colorService.GetById(33);

            Console.WriteLine(listColorsById);

            ICollection <Color> listColors = colorService.GetListAll();

            foreach (var l in listColors)
            {
                Console.WriteLine(l);
            }
            Console.ReadKey();
        }
Example #6
0
        public void Color_DeleteById_WithIdNull_Exception()
        {
            IService <Color> colorService = new ColorService();

            colorService.DeleteById(9999);
        }