Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public static void CleanUp()
        {
            foreach (var id in ReservedIds.GetReservedIds(ReservedIds.Group.Sets))
            {
                db.Entry(new Set {
                    SetId = id
                }).State = EntityState.Deleted;
            }

            foreach (var id in ReservedIds.GetReservedIds(ReservedIds.Group.Items))
            {
                db.Entry(new Item {
                    ItemId = id
                }).State = EntityState.Deleted;
            }

            db.SaveChanges();
        }
Ejemplo n.º 3
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));
        }