Пример #1
0
        public void Can_Perform_Add_On_ScriptRepository()
        {
            // Arrange
            var provider = new FileUnitOfWorkProvider();
            var unitOfWork = provider.GetUnitOfWork();
			var repository = new ScriptRepository(unitOfWork, _fileSystem);

            // Act
            var script = new Script("test-add-script.js") {Content = "/// <reference name=\"MicrosoftAjax.js\"/>"};
            repository.AddOrUpdate(script);
            unitOfWork.Commit();

            //Assert
            Assert.That(_fileSystem.FileExists("test-add-script.js"), Is.True);
        }
Пример #2
0
        public void Can_Perform_GetAll_With_Params_On_ScriptRepository()
        {
            // Arrange
            var provider = new FileUnitOfWorkProvider();
            var unitOfWork = provider.GetUnitOfWork();
            var repository = new ScriptRepository(unitOfWork, _fileSystem);

            var script = new Script("test-script1.js") { Content = "/// <reference name=\"MicrosoftAjax.js\"/>" };
            repository.AddOrUpdate(script);
            var script2 = new Script("test-script2.js") { Content = "/// <reference name=\"MicrosoftAjax.js\"/>" };
            repository.AddOrUpdate(script2);
            var script3 = new Script("test-script3.js") { Content = "/// <reference name=\"MicrosoftAjax.js\"/>" };
            repository.AddOrUpdate(script3);
            unitOfWork.Commit();

            // Act
            var scripts = repository.GetAll("test-script1.js", "test-script2.js");

            // Assert
            Assert.That(scripts, Is.Not.Null);
            Assert.That(scripts.Any(), Is.True);
            Assert.That(scripts.Any(x => x == null), Is.False);
            Assert.That(scripts.Count(), Is.EqualTo(2));
        }