示例#1
0
        public void GivenAnExistingEntity_WhenDeleting_TheEntityIsDeactivated()
        {
            var fakeEntity = new Entity {
                Id = 2, Status = EntityStatus.Active
            };
            var entityList = Enumerable.Range(0, 100)
                             .Select(r => r == fakeEntity.Id ? fakeEntity : new Entity {
                Id = r
            });

            contextMock.SetupGet(r => r.Entities).Returns(entityList.ToDbSet());

            var response = entitiesController.DeleteEntity(fakeEntity.Id);

            contextMock.Verify(r => r.SaveChanges(), Times.Once);
            Assert.AreEqual(EntityStatus.Deleted, fakeEntity.Status);
        }
        public void DeletePrefab(PrefabEnum prefab)
        {
            var prefab_entities = _metadatas.First(x => x.prefab == prefab).entities;

            prefab_entities.ForEach(x => _entitiesController.DeleteEntity(x));
            _mainWindow.RemoveEntitiesFromList(prefab_entities);
            _metadatas.First(x => x.prefab == prefab).menuItem.IsChecked = false;
        }