Fix a few more broken tests

This commit is contained in:
Timothy Baldridge 2020-04-03 16:33:19 -06:00
parent c22e40f752
commit 220382a3a8
4 changed files with 9 additions and 6 deletions

View File

@ -19,6 +19,7 @@ namespace Wabbajack.BuildServer.Test
private Task _task; private Task _task;
public readonly TempFolder _severTempFolder = new TempFolder(); public readonly TempFolder _severTempFolder = new TempFolder();
private bool _disposed = false;
public AbsolutePath ServerTempFolder => _severTempFolder.Dir; public AbsolutePath ServerTempFolder => _severTempFolder.Dir;
@ -43,6 +44,11 @@ namespace Wabbajack.BuildServer.Test
Consts.WabbajackBuildServerUri = new Uri("http://localhost:8080"); Consts.WabbajackBuildServerUri = new Uri("http://localhost:8080");
} }
~BuildServerFixture()
{
Dispose();
}
public T GetService<T>() public T GetService<T>()
{ {
return (T)_host.Services.GetService(typeof(T)); return (T)_host.Services.GetService(typeof(T));
@ -50,6 +56,8 @@ namespace Wabbajack.BuildServer.Test
public void Dispose() public void Dispose()
{ {
if (_disposed) return;
_disposed = true;
if (!_token.IsCancellationRequested) if (!_token.IsCancellationRequested)
_token.Cancel(); _token.Cancel();

View File

@ -164,9 +164,6 @@ namespace Wabbajack.BuildServer.Models.Jobs
Utils.Log(ex.ToString()); Utils.Log(ex.ToString());
return false; return false;
} }
return false;
} }
private async Task<bool> ValidateNexusFast(DBContext db, NexusDownloader.State state) private async Task<bool> ValidateNexusFast(DBContext db, NexusDownloader.State state)
@ -192,7 +189,7 @@ namespace Wabbajack.BuildServer.Models.Jobs
.FirstOrDefault(file => file.file_id == state.FileID && file.category_name != null); .FirstOrDefault(file => file.file_id == state.FileID && file.category_name != null);
return found != null; return found != null;
} }
catch (Exception ex) catch (Exception)
{ {
return false; return false;
} }

View File

@ -20,7 +20,6 @@ namespace Wabbajack.BuildServer.Model.Models
{ {
public class SqlService public class SqlService
{ {
private IConfiguration _configuration;
private AppSettings _settings; private AppSettings _settings;
public SqlService(AppSettings settings) public SqlService(AppSettings settings)

View File

@ -28,7 +28,6 @@ using Wabbajack.BuildServer.Controllers;
using Wabbajack.BuildServer.Models; using Wabbajack.BuildServer.Models;
using Microsoft.AspNetCore.Mvc.NewtonsoftJson; using Microsoft.AspNetCore.Mvc.NewtonsoftJson;
using Microsoft.AspNetCore.StaticFiles; using Microsoft.AspNetCore.StaticFiles;
using Wabbajack.BuildServer.Controllers;
using Microsoft.Extensions.FileProviders; using Microsoft.Extensions.FileProviders;
using Wabbajack.BuildServer.Model.Models; using Wabbajack.BuildServer.Model.Models;
using Directory = System.IO.Directory; using Directory = System.IO.Directory;