예제 #1
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);
        }
예제 #2
0
        public void Color_GetById_IsIdNotExist_Null()
        {
            const int        id           = 22220;
            IService <Color> colorService = new ColorService();

            Assert.IsNull(colorService.GetById(id));
        }
예제 #3
0
        public void Color_GetById_IsIdExist_Obj()
        {
            IService <Color> colorService = new ColorService();
            Color            newColor     = new Color(1002, "First");

            colorService.Create(newColor);
            Assert.IsNotNull(colorService.GetById(newColor.id));
        }
예제 #4
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();
        }