Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class DatabaseManager : IDisposable
public DatabaseManager(string databaseName = null)
{
var instanceId = Interlocked.Increment(ref InstanceCounter);
_databaseName = databaseName ?? $"coderTest{DateTime.Now:MMddHHmmss}_{instanceId}";
_databaseName = databaseName ?? $"coderrTest{DateTime.Now:MMddHHmmss}_{instanceId}";
Console.WriteLine("DBNMAE: " + _databaseName);
ConnectionString = ConnectionStringHelper.GetConnectionString().ConnectionString
.Replace("{databaseName}", _databaseName);
Expand All @@ -46,8 +46,6 @@ public void Dispose()
public void CreateEmptyDatabase()
{
Debug.WriteLine("*****DBNAME: " + ConnectionString);
var builder = new SqlConnectionStringBuilder(ConnectionString);
Environment.SetEnvironmentVariable("coderr_ConnectionString", $"Data Source={builder.DataSource}");

using (var con = OpenConnection(_masterConString))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public void ActivateAccount(int accountId)
}
}


/// <summary>
/// Creates an incident and a report.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using codeRR.Server.Api.Core.Incidents.Queries;
using codeRR.Server.SqlServer.Core.Accounts;
using codeRR.Server.SqlServer.Tests.Helpers;
using Griffin.Data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ public void Start(string site)
SetDefaultsWhereNecessary();

if (!File.Exists(ExePath))
throw new FileNotFoundException("Path to IIS Express executable is invalid: '" + ExePath + "'.");
throw new FileNotFoundException($"Path to IIS Express executable is invalid: '{ExePath}'.");

if (string.IsNullOrEmpty(ConfigPath) || !File.Exists(ConfigPath))
throw new FileNotFoundException("Path to IIS Express configuration file is invalid: '" + ConfigPath +
"'.");
throw new FileNotFoundException($"Path to IIS Express configuration file is invalid: '{ConfigPath}'.");

var iisExpressThread = new Thread(() => StartIisExpress(p => _process = p, site)) {IsBackground = true};
iisExpressThread.Start();
Expand All @@ -76,9 +75,9 @@ public void Start(string site)
Thread.Sleep(200);
attemptsLeft--;
}

if (_process == null)
throw new InvalidOperationException("Failed to start IIS express");

}

/// <summary>
Expand Down Expand Up @@ -155,7 +154,6 @@ private void StartIisExpress(Action<Process> action, string site)
if (!isRunning)
throw new InvalidOperationException("Failed to receive data from IIS ex");


action(process);
}
}
Expand Down
8 changes: 3 additions & 5 deletions src/Server/Coderr.Server.Web.Tests/WebTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ static WebTest()
mapper.Scan(typeof(AccountRepository).Assembly);
EntityMappingProvider.Provider = mapper;


_databaseManager.CreateEmptyDatabase();
_databaseManager.InitSchema();

Expand All @@ -39,12 +38,12 @@ static WebTest()
_iisExpress = new IisExpressHelper
{
ConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "applicationhost.config"),
EnvironmentVariables =
new Dictionary<string, string> { { "coderr_ConnectionString", _databaseManager.ConnectionString } }

// Pass on connectionstring to codeRR.Server.Web during testing, overriding connectionstring in web.config
EnvironmentVariables = new Dictionary<string, string> { { "coderr_ConnectionString", _databaseManager.ConnectionString } }
};
_iisExpress.Start("codeRR.Server.Web");


TestData = new TestDataManager(_databaseManager.OpenConnection);
WebDriver = DriverFactory.Create(BrowserType.Chrome);
AppDomain.CurrentDomain.DomainUnload += (o, e) => { DisposeWebDriver(); };
Expand All @@ -56,7 +55,6 @@ protected WebTest()
TestData.ResetDatabase(_iisExpress.BaseUrl);
}


public string ServerUrl => _iisExpress.BaseUrl;

public static TestDataManager TestData { get; }
Expand Down
Loading