Esempio n. 1
0
        public void Delete()
        {
            Script myScript = myScriptRepository.GetAll().First(item => item.Name.Equals("Prueba"));

            myScriptRepository.Delete(myScript.Id);

            Assert.IsTrue(myScriptRepository.GetAll().All(item => !item.Name.Equals("Prueba")));
        }
Esempio n. 2
0
 public ActionResult Delete(int id)
 {
     try
     {
         _LoggingService.Write("ScriptController (Delete) page access", true);
         _ScriptRepository.Delete(id);
         return(RedirectToAction("Index", "Home"));
     }
     catch (Exception ex)
     {
         _LoggingService.WriteWithInner(ex, true, "ScriptController(DeletePlane) error: ");
         return(new HttpNotFoundResult());
     }
 }
Esempio n. 3
0
        public void Can_Perform_Delete_On_ScriptRepository()
        {
            // Arrange
            var provider   = new FileUnitOfWorkProvider();
            var unitOfWork = provider.GetUnitOfWork();
            var repository = new ScriptRepository(unitOfWork, _fileSystem);

            // Act
            var script = repository.Get("test-script.js");

            repository.Delete(script);
            unitOfWork.Commit();

            // Assert
        }
        public void Can_Perform_Delete_On_ScriptRepository()
        {
            // Arrange
            var provider = new FileUnitOfWorkProvider(Mock.Of<IScopeProvider>());
            var unitOfWork = provider.GetUnitOfWork();
            var repository = new ScriptRepository(unitOfWork, _fileSystem, Mock.Of<IContentSection>());

            // Act
            var script = repository.Get("test-script.js");
            repository.Delete(script);
            unitOfWork.Commit();

            // Assert

            Assert.IsFalse(repository.Exists("test-script.js"));

        }
Esempio n. 5
0
        public void Can_Perform_Delete_On_ScriptRepository()
        {
            // Arrange
            var provider = TestObjects.GetScopeProvider(Logger);

            using (var scope = ScopeProvider.CreateScope())
            {
                var repository = new ScriptRepository(_fileSystems, Mock.Of <IContentSection>());

                // Act
                var script = repository.Get("test-script.js");
                repository.Delete(script);


                // Assert

                Assert.IsFalse(repository.Exists("test-script.js"));
            }
        }
Esempio n. 6
0
 /// <summary>
 /// Deletes an object with the specified resref from the database.
 /// </summary>
 /// <param name="resref">The resource reference to search for.</param>
 /// <param name="resourceType">The type of resource to remove.</param>
 /// <param name="connectionString">If you need to connect to a specific database, use this to pass the connection string. Otherwise, the default connection string will be used (WinterConnectionInformation.ActiveConnectionString)</param>
 public void DeleteFromDatabase(int resourceID, GameObjectTypeEnum resourceType, string connectionString = "")
 {
     if (resourceType == GameObjectTypeEnum.Area)
     {
         using (AreaRepository repo = new AreaRepository(connectionString))
         {
             repo.Delete(resourceID);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Conversation)
     {
         using (ConversationRepository repo = new ConversationRepository(connectionString))
         {
             repo.Delete(resourceID);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Creature)
     {
         using (CreatureRepository repo = new CreatureRepository(connectionString))
         {
             repo.Delete(resourceID);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Item)
     {
         using (ItemRepository repo = new ItemRepository(connectionString))
         {
             repo.Delete(resourceID);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Placeable)
     {
         using (PlaceableRepository repo = new PlaceableRepository(connectionString))
         {
             repo.Delete(resourceID);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Script)
     {
         using (ScriptRepository repo = new ScriptRepository(connectionString))
         {
             repo.Delete(resourceID);
         }
     }
     else if (resourceType == GameObjectTypeEnum.Tileset)
     {
         using (TilesetRepository repo = new TilesetRepository(connectionString))
         {
             repo.Delete(resourceID);
         }
     }
     else if (resourceType == GameObjectTypeEnum.GameModule)
     {
         using (GameModuleRepository repo = new GameModuleRepository())
         {
             repo.Delete(resourceID);
         }
     }
     else
     {
         throw new NotSupportedException();
     }
 }
        public void Can_Perform_Delete_On_ScriptRepository()
        {
            // Arrange
            var provider = new FileUnitOfWorkProvider();
            var unitOfWork = provider.GetUnitOfWork();
			var repository = new ScriptRepository(unitOfWork, _fileSystem);

            // Act
            var script = repository.Get("test-script.js");
            repository.Delete(script);
            unitOfWork.Commit();

            // Assert

        }