diff --git a/appveyor.yml b/appveyor.yml index d5e2bda..75bac98 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,6 +3,7 @@ skip_tags: true image: Visual Studio 2015 configuration: Release install: + - mklink /J Data "test/Mime-Detective.Tests/Data" - ps: mkdir -Force ".\build\" | Out-Null - ps: Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0-preview2/scripts/obtain/dotnet-install.ps1" -OutFile ".\build\installcli.ps1" - ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetcli" diff --git a/src/GenericMvc.Test.Library/Repository/IRepositoryTests.cs b/src/GenericMvc.Test.Library/Repository/IRepositoryTests.cs index 68b612e..4fa66cc 100644 --- a/src/GenericMvc.Test.Library/Repository/IRepositoryTests.cs +++ b/src/GenericMvc.Test.Library/Repository/IRepositoryTests.cs @@ -305,7 +305,7 @@ public virtual async Task Update() } [Fact] - public virtual async Task UpdateRange() + public virtual Task UpdateRange() { foreach (var range in _ranges) { @@ -329,6 +329,8 @@ public virtual async Task UpdateRange() //_DataToCleanUp.AddRange(createdRangeX); } + + return Task.FromResult(null); } /* to do place in decendant class diff --git a/src/GenericMvc.Test.Library/project.json b/src/GenericMvc.Test.Library/project.json index 35f5d20..5fbe0e5 100644 --- a/src/GenericMvc.Test.Library/project.json +++ b/src/GenericMvc.Test.Library/project.json @@ -16,7 +16,6 @@ "GenericMvc": { "target": "project" } }, "frameworks": { - //"net4.6": { }, "netstandard1.6": { "imports": [ "dnxcore50", diff --git a/src/GenericMvc/Repositories/FileRepository.cs b/src/GenericMvc/Repositories/FileRepository.cs index 2b49873..9ba30b2 100644 --- a/src/GenericMvc/Repositories/FileRepository.cs +++ b/src/GenericMvc/Repositories/FileRepository.cs @@ -74,16 +74,12 @@ public FileRepository(string rootFolder, bool includeNestedDirectories = false) if (rootFolder != null) { //check if folder exists here - if (System.IO.Directory.Exists(rootFolder)) - { - this.RootFolder = rootFolder; + if (!System.IO.Directory.Exists(rootFolder)) + throw new System.IO.DirectoryNotFoundException(rootFolder); - this._directoryInfo = new System.IO.DirectoryInfo(rootFolder); - } - else - { - throw new ArgumentException(rootFolder); - } + this.RootFolder = rootFolder; + + this._directoryInfo = new System.IO.DirectoryInfo(rootFolder); } else { @@ -101,7 +97,7 @@ private Task FileInitSwitch(DataFile entity) switch (DefaultLoadingSettings) { case FileLoading.JustFileInfo: - return Task.FromResult(entity.Initialize(path:"")); + return Task.FromResult(entity.Initialize(path: "")); case FileLoading.WithMime: return entity.Initialize(false, FileEncodingType); @@ -110,7 +106,7 @@ private Task FileInitSwitch(DataFile entity) return entity.Initialize(true, FileEncodingType); default: - return Task.FromResult(entity.Initialize(path:"")); + return Task.FromResult(entity.Initialize(path: "")); } } @@ -254,7 +250,7 @@ private async Task createFile(DataFile entity) } else { - throw new System.IO.IOException("Cannot write to file: " + entity.Name); + throw new System.IO.IOException($"Cannot write to file: {entity.Name}, {entity.Id}"); } } } @@ -267,26 +263,18 @@ private Exception checkFileForUpdate(DataFile file) //var dirInfo = new System.IO.DirectoryInfo(file.ContainingFolder); if (_directoryInfo.GetFiles(file.Name).Count() == 1) - { return null; - } else - { - return new System.IO.IOException("File does not Exist"); - } + return new System.IO.FileNotFoundException($"{file.Name} does net exist", file.Id); } else - { return new ArgumentNullException(nameof(file), "File Data is Null"); - } } private async Task updateFile(DataFile entity) { if (entity._fileInfo == null) - { - entity.Initialize(path:""); - } + entity.Initialize(path: ""); //if (System.IO.Directory.Exists(ContainingFolder) && this._fileInfo.Exists) @@ -569,7 +557,7 @@ public Task Delete(DataFile entity) { if (entity._fileInfo == null) { - entity.Initialize(path:""); + entity.Initialize(path: ""); } entity._fileInfo.Delete(); diff --git a/src/GenericMvc/project.json b/src/GenericMvc/project.json index ed8311c..388d9f2 100644 --- a/src/GenericMvc/project.json +++ b/src/GenericMvc/project.json @@ -52,7 +52,6 @@ }, "frameworks": { - //"net4.6": {}, "netstandard1.6": { "imports": [ "portable-net451+win8" diff --git a/test/GenericMvc.Tests/project.json b/test/GenericMvc.Tests/project.json index 68f722c..1f12707 100644 --- a/test/GenericMvc.Tests/project.json +++ b/test/GenericMvc.Tests/project.json @@ -20,7 +20,6 @@ "GenericMvc.Test.Library": { "target": "project" } }, "frameworks": { - //"net4.6": {}, "netcoreapp1.0": { "define": [ "ASYNCLOCAL" ], "dependencies": { diff --git a/test/GenericMvc.Tests/project.lock.json b/test/GenericMvc.Tests/project.lock.json index 2764fd0..8cabbaa 100644 --- a/test/GenericMvc.Tests/project.lock.json +++ b/test/GenericMvc.Tests/project.lock.json @@ -4313,7 +4313,7 @@ "framework": ".NETStandard,Version=v1.6", "dependencies": { "GenFu": "1.2.1", - "GenericMvc": "1.0.0", + "GenericMvc": "(, )", "Microsoft.AspNetCore.TestHost": "1.1.0", "Microsoft.EntityFrameworkCore.InMemory": "1.1.0", "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",