added tests for module management page

This commit is contained in:
Malachy Byrne 2023-05-05 16:51:07 +01:00
parent 68aebf085e
commit 6ff59b5f8a
Signed by: malmal200
GPG Key ID: EC21443030A655D9

View File

@ -7,7 +7,7 @@ using System.Net.Http;
public class ModuleConfigTests : TestContext public class ModuleConfigTests : TestContext
{ {
[Fact] [Fact]
public void ImageNameInputFieldIsPresent() public void NameInputFieldIsPresent()
{ {
Services.AddSingleton<IHttpService, HttpService>(); Services.AddSingleton<IHttpService, HttpService>();
// Arrange // Arrange
@ -16,7 +16,55 @@ public class ModuleConfigTests : TestContext
var cut = ctx.RenderComponent<ModConfig>(); var cut = ctx.RenderComponent<ModConfig>();
// Act // Act
var input = cut.Find("input[name='ImageName']"); var input = cut.Find("input[name='name']");
// Assert
Assert.NotNull(input);
}
[Fact]
public void ImageInputFieldIsPresent()
{
Services.AddSingleton<IHttpService, HttpService>();
// Arrange
using var ctx = new TestContext();
ctx.Services.AddSingleton<IHttpService, HttpService>();
var cut = ctx.RenderComponent<ModConfig>();
// Act
var input = cut.Find("input[name='image']");
// Assert
Assert.NotNull(input);
}
[Fact]
public void UserInputFieldIsPresent()
{
Services.AddSingleton<IHttpService, HttpService>();
// Arrange
using var ctx = new TestContext();
ctx.Services.AddSingleton<IHttpService, HttpService>();
var cut = ctx.RenderComponent<ModConfig>();
// Act
var input = cut.Find("input[name='user']");
// Assert
Assert.NotNull(input);
}
[Fact]
public void InternalInputFieldIsPresent()
{
Services.AddSingleton<IHttpService, HttpService>();
// Arrange
using var ctx = new TestContext();
ctx.Services.AddSingleton<IHttpService, HttpService>();
var cut = ctx.RenderComponent<ModConfig>();
// Act
var input = cut.Find("input[name='internal']");
// Assert // Assert
Assert.NotNull(input); Assert.NotNull(input);