public void ModelCar_Update_WithIdNull_Exception()
        {
            IService <ModelCar> modelCarService = new ModelCarService();
            ModelCar            newModelCar     = new ModelCar();

            modelCarService.Update(newModelCar);
        }
        public void ModelCar_GetById_IsIdExist_Obj()
        {
            IService <ModelCar> modelCarService = new ModelCarService();
            ModelCar            newModelCar     = new ModelCar(1002, "First");

            modelCarService.Create(newModelCar);
            Assert.IsNotNull(modelCarService.GetById(newModelCar.id));
        }
        public void ModelCar_GetListAll_NotEmpty_ReturnCollection()
        {
            IService <ModelCar> modelCarService  = new ModelCarService();
            ModelCar            newModelCarFirst = new ModelCar(1001, "First");

            modelCarService.Create(newModelCarFirst);
            Assert.IsTrue(modelCarService.GetListAll().Count > 0);
        }
        public void ModelCar_Create_WithIdDublicate_ThrowExeption()
        {
            IService <ModelCar> modelCarService   = new ModelCarService();
            ModelCar            newModelCarFirst  = new ModelCar(1000, "First");
            ModelCar            newModelCarSecond = new ModelCar(1000, "Second");

            modelCarService.Create(newModelCarFirst);
            modelCarService.Create(newModelCarSecond);
        }
        public void ModelCar_Create_WithIdNotNull_True()
        {
            IService <ModelCar> modelCarService = new ModelCarService();
            int      countBefore = modelCarService.GetListAll().Count;
            ModelCar newModelCar = new ModelCar(999, "Audi");

            modelCarService.Create(newModelCar);
            int countAfter = modelCarService.GetListAll().Count;

            Assert.AreNotEqual(countBefore, countAfter);
        }
        public void ModelCar_DeleteById_WithIdNotNull_True()
        {
            IService <ModelCar> modelCarService = new ModelCarService();
            ModelCar            newModelCar     = new ModelCar(1005, "Audi");

            modelCarService.Create(newModelCar);
            int countBefore = modelCarService.GetListAll().Count;

            modelCarService.DeleteById(1005);
            int countAfter = modelCarService.GetListAll().Count;

            Assert.IsTrue(countBefore > countAfter);
        }
        public void ModelCar_Update_WithIdNotNull_True()
        {
            IService <ModelCar> modelCarService = new ModelCarService();
            ModelCar            newModelCar     = new ModelCar(1004, "Audi");

            modelCarService.Create(newModelCar);
            ModelCar crModelCar  = modelCarService.GetById(333);
            ModelCar modModelCar = new ModelCar(1004, "VW");

            modelCarService.Update(modModelCar);
            ModelCar updModelCar = modelCarService.GetById(1004);

            Assert.AreEqual(crModelCar.id, updModelCar.id);
            Assert.AreNotEqual(crModelCar.model, updModelCar.model);
        }