コード例 #1
0
        public void InsertResult()
        {
            var category = new PollCategory()
            {
                PollCategoryID = Guid.NewGuid(),
                Region = "Zimbabwae",
                ServerCategory = "Something awesome"
            };

            var db = new UptimeDB();
            db.PollCategories.Add(category);

            var value = new PollCategoryValue()
            {
                CategoryID = category.PollCategoryID,
                CreatedTime = DateTime.Now,
                Status = PollStatusType.Up
            };
            db.PollCategoryValue.Add(value);

            var totalInserted = db.SaveChanges();
            Assert.AreEqual(2, totalInserted);

            db.PollCategoryValue.Remove(value);
            db.PollCategories.Remove(category);
            db.SaveChanges();
        }