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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ _ReSharper*/
src/Tools/MarkdownToNamespaceDoc/packages/*/
src/Tools/TsGenerator/.vs/*
src/Help/*
src/Server/Coderr.Server.Web.Tests/applicationhost.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Data.SqlClient;
using System.Diagnostics;
using System.Threading;
using codeRR.Server.SqlServer.Tools;
using Griffin.Data;
using Griffin.Data.Mapper;

Expand Down Expand Up @@ -35,17 +34,17 @@ public DatabaseManager(string databaseName = null, Func<string> connectionString

var instanceId = Interlocked.Increment(ref InstanceCounter);
_databaseName = databaseName ?? $"coderrTest{DateTime.Now:MMddHHmmss}_{instanceId}";
Console.WriteLine("DBNMAE: " + _databaseName);
Console.WriteLine("DBNAME: " + _databaseName);
ConnectionString = connectionStringTemplateProvider()
.Replace("{databaseName}", _databaseName);
_masterConString = connectionStringTemplateProvider()
.Replace("{databaseName}", "master");
UpdateToLatestVestion = true;
UpdateToLatestVersion = true;
}

public string ConnectionString { get; }

public bool UpdateToLatestVestion { get; set; }
public bool UpdateToLatestVersion { get; set; }

public void Dispose()
{
Expand Down Expand Up @@ -93,7 +92,7 @@ public void InitSchema()
{
var schemaManager = new SchemaManager(OpenConnection);
schemaManager.CreateInitialStructure();
if (UpdateToLatestVestion)
if (UpdateToLatestVersion)
schemaManager.UpgradeDatabaseSchema();
}
catch (SqlException ex)
Expand Down
15 changes: 5 additions & 10 deletions src/Server/Coderr.Server.SqlServer.Tests/SchemaManagerTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Threading;
using System.Threading;
using codeRR.Server.SqlServer.Tests.Helpers;
using FluentAssertions;
using Griffin.Data.Mapper;
using Xunit;

namespace codeRR.Server.SqlServer.Tests
Expand All @@ -17,7 +15,7 @@ public void Should_report_upgradable_if_schema_version_is_less()
Thread.Sleep(1000);
using (var dbMgr = new DatabaseManager())
{
dbMgr.UpdateToLatestVestion = false;
dbMgr.UpdateToLatestVersion = false;
dbMgr.CreateEmptyDatabase();
dbMgr.InitSchema();
dbMgr.UpdateSchema(1);
Expand All @@ -27,7 +25,6 @@ public void Should_report_upgradable_if_schema_version_is_less()

actual.Should().BeTrue();
}

}

[Fact]
Expand All @@ -36,7 +33,7 @@ public void Should_not_report_upgradable_if_schema_version_is_same()
Thread.Sleep(1000);
using (var dbMgr = new DatabaseManager())
{
dbMgr.UpdateToLatestVestion = false;
dbMgr.UpdateToLatestVersion = false;
dbMgr.CreateEmptyDatabase();
dbMgr.InitSchema();
dbMgr.UpdateSchema(-1);
Expand All @@ -54,7 +51,7 @@ public void Should_report_upgradable_if_schema_table_is_missing()
Thread.Sleep(1000);
using (var dbMgr = new DatabaseManager())
{
dbMgr.UpdateToLatestVestion = false;
dbMgr.UpdateToLatestVersion = false;
dbMgr.CreateEmptyDatabase();

var sut = new SchemaManager(() => dbMgr.OpenConnection());
Expand All @@ -70,15 +67,13 @@ public void Should_be_able_to_upgrade_schema()
Thread.Sleep(1000);
using (var dbMgr = new DatabaseManager())
{
dbMgr.UpdateToLatestVestion = false;
dbMgr.UpdateToLatestVersion = false;
dbMgr.CreateEmptyDatabase();
dbMgr.InitSchema();

var sut = new SchemaManager(() => dbMgr.OpenConnection());
sut.UpgradeDatabaseSchema();

}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class IisExpressHelper
/// </summary>
public string AppPool { get; set; }

public string BaseUrl => "http://localhost:50473/";
public string BaseUrl => "http://localhost:50473/coderr/";

/// <summary>
/// Path to the IIS Express configuration file. Defaults to
Expand Down
1 change: 0 additions & 1 deletion src/Server/Coderr.Server.Web.Tests/Tests/HomePageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

namespace codeRR.Server.Web.Tests.Tests
{

[Trait("Category", "Integration")]
public class HomePageTests : LoggedInTest
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Threading;
using codeRR.Client;
using codeRR.Server.Web.Tests.Helpers;
using codeRR.Server.Web.Tests.Pages;
using Xunit;

Expand Down
1 change: 0 additions & 1 deletion src/Server/Coderr.Server.Web.Tests/Tests/LoginPageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

namespace codeRR.Server.Web.Tests.Tests
{

[Trait("Category", "Integration")]
public class LoginPageTests : LoggedInTest
{
Expand Down
14 changes: 9 additions & 5 deletions src/Server/Coderr.Server.Web.Tests/WebTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
using codeRR.Server.SqlServer.Tests.Helpers;
using codeRR.Server.Web.Tests.Helpers;
using codeRR.Server.Web.Tests.Helpers.Selenium;
using codeRR.Server.Web.Tests.Helpers.xUnit;
using Griffin.Data.Mapper;
using OpenQA.Selenium;
using OpenQA.Selenium.Support.Extensions;
using Xunit;

[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)]

namespace codeRR.Server.Web.Tests
{
[TestCaseOrderer("codeRR.Server.Web.Tests.Helpers.xUnit.TestCaseOrderer", "codeRR.Server.Web.Tests")]
Expand All @@ -34,10 +35,15 @@ static WebTest()
_databaseManager.Dispose();
};

_iisExpress = new IisExpressHelper();
var configPath =
Path.Combine(Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..\")),
"applicationhost.config");

Console.WriteLine($"Path to IIS Express configuration file '{configPath}'");

_iisExpress = new IisExpressHelper
{
ConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "applicationhost.config"),
ConfigPath = configPath,

// Pass on connectionstring to codeRR.Server.Web during testing, overriding connectionstring in web.config
EnvironmentVariables = new Dictionary<string, string> { { "coderr_ConnectionString", _databaseManager.ConnectionString } }
Expand All @@ -51,7 +57,6 @@ static WebTest()

protected WebTest()
{

TestData.ResetDatabase(_iisExpress.BaseUrl);
}

Expand All @@ -61,7 +66,6 @@ protected WebTest()

public static IWebDriver WebDriver { get; private set; }


private static void DisposeWebDriver()
{
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>applicationhost.tt</DependentUpon>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
<None Update="applicationhost.tt">
<Generator>TextTemplatingFileGenerator</Generator>
Expand Down