コード例 #1
0
        public void EF_Then_Can_Update_Advertisement()
        {
            // ARRANGE
            using (var entityModel = new BookAdEntities())
            {
                var values = entityModel.Advertisements.ToList();

                // ACT
                var value = values.First();
                value.ClientName = "Tester";

                // ASSERT
                entityModel.SaveChanges();
            }
        }
コード例 #2
0
        public void EF_Then_Can_Delete_Advertisement()
        {
            // ARRANGE
            using (var entityModel = new BookAdEntities())
            {
                var values = entityModel.Advertisements.ToList();

                // ACT
                var value = values.First();

                // ASSERT
                entityModel.Advertisements.Remove(value);
                entityModel.SaveChanges();
            }
        }
コード例 #3
0
        public void EF_Can_Create_Advertisement()
        {
            // ARRANGE
            using (var entityModel = new BookAdEntities())
            {
                // ACT
                var advertisement = new Advertisement
                {
                    BookingDateTimeUtc = DateTime.UtcNow,
                    ClientName         = "Test",
                    DurationSeconds    = 60
                };

                // ASSERT
                entityModel.Advertisements.Add(advertisement);
                entityModel.SaveChanges();
            }
        }