Added web module tests

This commit is contained in:
2025-01-19 16:00:33 +01:00
parent 8d63910aae
commit 80aa650a2c
26 changed files with 587 additions and 71 deletions

View File

@@ -0,0 +1,34 @@
using HopFrame.Core.Config;
using HopFrame.Tests.Core.Models;
using Moq;
namespace HopFrame.Tests.Core.Config;
public class DbContextConfiguratorTests {
[Fact]
public void Table_WithConfigurator_InvokesConfigurator() {
// Arrange
var dbContextConfig = new DbContextConfig(typeof(MockDbContext));
var configurator = new DbContextConfigurator<MockDbContext>(dbContextConfig);
var mockConfigurator = new Mock<Action<TableConfigurator<MockModel>>>();
// Act
configurator.Table<MockModel>(mockConfigurator.Object);
// Assert
mockConfigurator.Verify(c => c.Invoke(It.IsAny<TableConfigurator<MockModel>>()), Times.Once);
}
[Fact]
public void Table_ReturnsCorrectTableConfigurator() {
// Arrange
var dbContextConfig = new DbContextConfig(typeof(MockDbContext));
var configurator = new DbContextConfigurator<MockDbContext>(dbContextConfig);
// Act
var tableConfigurator = configurator.Table<MockModel>();
// Assert
Assert.IsType<TableConfigurator<MockModel>>(tableConfigurator);
}
}