Пример #1
0
        public void Genre_add_working_test()
        {
            Genre genre = new Genre() { Name = "test2"};

            Context context = new Context();
            genre = context.Genres.Add(genre);
            context = new Context();
        }
Пример #2
0
        public void Customer_saved_to_db_on_create_test()
        {
            Customer cos = new Customer()
            {
                Id = 1,
                Address = "Address1",
                BirthDate = DateTime.Now,
                Email = "Email1",
                FirstName = "Jonas",
                LastName = "Olesen",
                PhoneNumber = 22755692
            };

            Context context = new Context();
            context.Customers.Add(cos);
            context.SaveChanges();

            Context context2 = new Context();
            Assert.AreEqual(context2.Customers.FirstOrDefault(x => x.Id == cos.Id).FirstName, cos.FirstName);
            Assert.AreEqual(context2.Customers.FirstOrDefault(x => x.Id == cos.Id).LastName, cos.LastName);
            Assert.AreEqual(context2.Customers.FirstOrDefault(x => x.Id == cos.Id).Email, cos.Email);
            Assert.AreEqual(context2.Customers.FirstOrDefault(x => x.Id == cos.Id).PhoneNumber, cos.PhoneNumber);
            Assert.AreEqual(context2.Customers.FirstOrDefault(x => x.Id == cos.Id).Address, cos.Address);
        }