Skip to content

Commit 734355e

Browse files
committed
Add more tests
1 parent b2071f7 commit 734355e

3 files changed

Lines changed: 17 additions & 12 deletions

File tree

.vscode/tasks.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"type": "process",
88
"args": [
99
"build",
10-
"${workspaceFolder}/Rnwood.Smtp4dev",
1110
"/property:GenerateFullPaths=true"
1211
],
1312
"problemMatcher": "$msCompile",

Rnwood.Smtp4dev.Tests/E2E/E2ETests.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ public E2ETests(ITestOutputHelper output)
2424

2525
public class E2ETestOptions
2626
{
27-
public bool InMemoryDB { get; set; }
28-
public string BasePath { get; set; }
29-
public IDictionary<string,string> EnvironmentVariables { get; set; } = new Dictionary<string,string>();
27+
public required bool InMemoryDB { get; set; }
28+
public required string BasePath { get; set; }
29+
30+
public string TestPath { get; set; }
31+
public IDictionary<string, string> EnvironmentVariables { get; set; } = new Dictionary<string, string>();
3032
}
3133

3234
public class E2ETestContext
@@ -156,7 +158,7 @@ protected void RunE2ETest(Action<E2ETestContext> test, E2ETestOptions options =
156158
if (newLine.StartsWith("Now listening on: http://"))
157159
{
158160
int portNumber = int.Parse(Regex.Replace(newLine, @".*http://[^\s]+:(\d+)", "$1"));
159-
baseUrl = new Uri($"http://localhost:{portNumber}{options.BasePath ?? ""}");
161+
baseUrl = new Uri($"http://localhost:{portNumber}{options.TestPath ?? options.BasePath ?? ""}");
160162
}
161163

162164
if (newLine.StartsWith("SMTP Server is listening on port"))

Rnwood.Smtp4dev.Tests/E2E/E2ETests_WebUI_CheckMessageIsReceivedAndDisplayed.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@ public E2ETests_WebUI_CheckMessageIsReceivedAndDisplayed(ITestOutputHelper outpu
1717
{
1818
}
1919

20-
[Theory]
21-
[InlineData("/", false)]
22-
[InlineData("/", true)]
23-
[InlineData("/smtp4dev", true)]
24-
public void CheckMessageIsReceivedAndDisplayed(string basePath, bool inMemoryDb)
20+
[Theory]
21+
[InlineData("", "", false)]
22+
[InlineData("", "/", true)]
23+
[InlineData("/smtp4dev", "/smtp4dev", true)]
24+
[InlineData("/smtp4dev", "/smtp4dev/", true)]
25+
[InlineData("/smtp4dev", "", true)]
26+
[InlineData("/smtp4dev", "/", true)]
27+
public void CheckMessageIsReceivedAndDisplayed(string basePath, string testPath, bool inMemoryDb)
2528
{
2629
RunUITestAsync($"{nameof(CheckMessageIsReceivedAndDisplayed)}-{basePath}-{inMemoryDb}", async (page, baseUrl, smtpPortNumber) =>
2730
{
@@ -59,13 +62,14 @@ public void CheckMessageIsReceivedAndDisplayed(string basePath, bool inMemoryDb)
5962
var rows = await grid.GetRowsAsync();
6063
return rows.FirstOrDefault();
6164
});
62-
65+
6366
Assert.NotNull(messageRow);
6467
Assert.True(await messageRow.ContainsTextAsync(messageSubject));
6568
}, new UITestOptions
6669
{
6770
InMemoryDB = inMemoryDb,
68-
BasePath = basePath
71+
BasePath = basePath,
72+
TestPath = testPath
6973
});
7074
}
7175
}

0 commit comments

Comments
 (0)