示例#1
0
        public void should_insert_new_set()
        {
            var set = new Set
            {
                SetId = ReservedIds.GetNexIdFor(ReservedIds.Group.Sets),
                Name  = "New Set"
            };

            Subject.Sets.Add(set);
            var result = Subject.SaveChanges();

            Assert.AreNotEqual(0, result);
            Assert.AreEqual(EntityState.Unchanged, Subject.Entry(set).State);
        }
示例#2
0
        public void Should_save_items_and_set()
        {
            var set = new Set
            {
                SetId = ReservedIds.GetNexIdFor(ReservedIds.Group.Sets),
                Name  = "New Set 2",
                Items = new List <Item>
                {
                    new Item
                    {
                        ItemId  = ReservedIds.GetNexIdFor(ReservedIds.Group.Items),
                        Slot    = SlotType.Chest,
                        Quality = QualityType.Artifact
                    }
                }
            };

            Subject.Sets.Add(set);
            var result = Subject.SaveChanges();

            Assert.AreEqual(EntityState.Unchanged, Subject.Entry(set).State);
            Assert.IsTrue(set.Items.All(i => Subject.Entry(i).State == EntityState.Unchanged));
        }