public void SetUp()
        {
            repo   = new ModelRepositoryMock();
            models = repo.GetAll().ToList();

            if (models.Count() > 5)
            {
                models.RemoveAll(m => m.ModelId > 5);
            }
        }
        public void CanGetModelById()
        {
            ModelRepositoryMock repo = new ModelRepositoryMock();

            Model Model = repo.GetAll().FirstOrDefault(c => c.ModelId == 3);

            Assert.AreEqual(Model.ModelId, 3);
            Assert.AreEqual(Model.ModelName, "TLX");
            Assert.AreEqual(Model.DateAdded, new DateTime(2017, 7, 2));
        }
        public void CanGetAllModels()
        {
            ModelRepositoryMock repo = new ModelRepositoryMock();

            List <Model> Models = repo.GetAll().ToList();

            Assert.AreEqual(5, Models.Count);

            Assert.AreEqual(Models[2].ModelId, 3);
            Assert.AreEqual(Models[2].ModelName, "TLX");
            Assert.AreEqual(Models[2].DateAdded, new DateTime(2017, 7, 2));
        }
        public void MockCanAddModel()
        {
            var model = new Model()
            {
                Name      = "Challenger",
                DateAdded = DateTime.Parse("6/6/2006")
            };

            repo.Insert(model);
            models = repo.GetAll().ToList();

            Assert.AreEqual(6, models.Count());
            Assert.AreEqual("Challenger", models[5].Name);
            Assert.AreEqual(DateTime.Parse("6/6/2006"), models[5].DateAdded);
        }
        public void CanAddModel()
        {
            Model model = new Model
            {
                MakeId    = 2,
                ModelName = "TestModel",
                DateAdded = DateTime.Now.Date,
                Addedby   = "*****@*****.**"
            };

            ModelRepositoryMock repo = new ModelRepositoryMock();

            repo.Insert(model);

            List <Model> Models = repo.GetAll().ToList();

            Assert.AreEqual(6, Models.Count);

            Assert.AreEqual(6, Models[5].ModelId);
            Assert.AreEqual(2, Models[5].MakeId);
            Assert.AreEqual(model.ModelName, Models[5].ModelName);
            Assert.AreEqual(model.DateAdded, Models[5].DateAdded);
            Assert.AreEqual(model.Addedby, Models[5].Addedby);
        }