Added modular event system
This commit is contained in:
@@ -11,7 +11,7 @@ public class ContextExplorerTests {
|
||||
public void GetTables_ReturnsNonIgnoredTables() {
|
||||
// Arrange
|
||||
var config = new HopFrameConfig();
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext));
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext), null!);
|
||||
var tableConfig1 = contextConfig.Tables[0];
|
||||
var tableConfig2 = contextConfig.Tables[1];
|
||||
config.Contexts.Add(contextConfig);
|
||||
@@ -33,7 +33,7 @@ public class ContextExplorerTests {
|
||||
public void GetTable_ByDisplayName_ReturnsCorrectTable() {
|
||||
// Arrange
|
||||
var config = new HopFrameConfig();
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext));
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext), null!);
|
||||
var tableConfig = contextConfig.Tables[0];
|
||||
config.Contexts.Add(contextConfig);
|
||||
tableConfig.DisplayName = "TestTable";
|
||||
@@ -54,7 +54,7 @@ public class ContextExplorerTests {
|
||||
public void GetTable_ByDisplayName_ReturnsNullIfTableNotFound() {
|
||||
// Arrange
|
||||
var config = new HopFrameConfig();
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext));
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext), null!);
|
||||
var tableConfig = contextConfig.Tables[0];
|
||||
config.Contexts.Add(contextConfig);
|
||||
tableConfig.DisplayName = "TestTable";
|
||||
@@ -74,7 +74,7 @@ public class ContextExplorerTests {
|
||||
public void GetTable_ByType_ReturnsCorrectTable() {
|
||||
// Arrange
|
||||
var config = new HopFrameConfig();
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext));
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext), null!);
|
||||
var tableConfig = contextConfig.Tables[0];
|
||||
config.Contexts.Add(contextConfig);
|
||||
|
||||
@@ -94,7 +94,7 @@ public class ContextExplorerTests {
|
||||
public void GetTable_ByType_ReturnsNullIfTableNotFound() {
|
||||
// Arrange
|
||||
var config = new HopFrameConfig();
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext));
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext), null!);
|
||||
var tableConfig = contextConfig.Tables[0];
|
||||
config.Contexts.Add(contextConfig);
|
||||
|
||||
@@ -113,7 +113,7 @@ public class ContextExplorerTests {
|
||||
public void GetTableManager_ReturnsCorrectTableManager() {
|
||||
// Arrange
|
||||
var config = new HopFrameConfig();
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext));
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext), null!);
|
||||
var tableConfig = new TableConfig(contextConfig, typeof(MockModel), "Models", 0);
|
||||
contextConfig.Tables.Add(tableConfig);
|
||||
config.Contexts.Add(contextConfig);
|
||||
@@ -135,7 +135,7 @@ public class ContextExplorerTests {
|
||||
public void GetTableManager_ReturnsNullIfDbContextNotFound() {
|
||||
// Arrange
|
||||
var config = new HopFrameConfig();
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext));
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext), null!);
|
||||
var tableConfig = new TableConfig(contextConfig, typeof(MockModel), "MockModels", 0);
|
||||
contextConfig.Tables.Add(tableConfig);
|
||||
config.Contexts.Add(contextConfig);
|
||||
@@ -154,7 +154,7 @@ public class ContextExplorerTests {
|
||||
public void GetTableManager_ReturnsNullIfTableNotFound() {
|
||||
// Arrange
|
||||
var config = new HopFrameConfig();
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext));
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext), null!);
|
||||
var tableConfig = new TableConfig(contextConfig, typeof(MockModel), "Models", 0);
|
||||
contextConfig.Tables.Add(tableConfig);
|
||||
config.Contexts.Add(contextConfig);
|
||||
@@ -175,7 +175,7 @@ public class ContextExplorerTests {
|
||||
public void SeedTableData_SetsTableSeededFlag() {
|
||||
// Arrange
|
||||
var config = new HopFrameConfig();
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext));
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext), null!);
|
||||
var tableConfig = contextConfig.Tables[0];
|
||||
config.Contexts.Add(contextConfig);
|
||||
|
||||
@@ -194,7 +194,7 @@ public class ContextExplorerTests {
|
||||
public void SeedTableData_SetsTablePropertiesCorrectly() {
|
||||
// Arrange
|
||||
var config = new HopFrameConfig();
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext));
|
||||
var contextConfig = new DbContextConfig(typeof(MockDbContext), null!);
|
||||
var tableConfig = contextConfig.Tables[0];
|
||||
var tableConfig2 = contextConfig.Tables[1];
|
||||
config.Contexts.Add(contextConfig);
|
||||
|
||||
@@ -17,7 +17,7 @@ public class DisplayPropertyTests {
|
||||
var contextMock = new Mock<DbContext>();
|
||||
_providerMock = new Mock<IServiceProvider>();
|
||||
_explorerMock = new Mock<IContextExplorer>();
|
||||
_config = new TableConfig(new DbContextConfig(typeof(MockDbContext)), typeof(MockModel), "Models", 0);
|
||||
_config = new TableConfig(new DbContextConfig(typeof(MockDbContext), null!), typeof(MockModel), "Models", 0);
|
||||
_tableManager =
|
||||
new TableManager<object>(contextMock.Object, _config, _explorerMock.Object, _providerMock.Object);
|
||||
}
|
||||
@@ -106,7 +106,7 @@ public class DisplayPropertyTests {
|
||||
|
||||
_explorerMock
|
||||
.Setup(e => e.GetTable(item.Inner.GetType()))
|
||||
.Returns(new TableConfig(new DbContextConfig(typeof(MockDbContext)), typeof(MockModel), "Models", 0) {
|
||||
.Returns(new TableConfig(new DbContextConfig(typeof(MockDbContext), null!), typeof(MockModel), "Models", 0) {
|
||||
Properties = { innerPropConfig }
|
||||
});
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class TableManagerTests {
|
||||
new MockModel { Id = 3, Name = "Item3" }
|
||||
};
|
||||
var dbContext = CreateMockDbContext(data);
|
||||
var config = new TableConfig(new DbContextConfig(typeof(MockDbContext)), typeof(MockModel), "Models", 0);
|
||||
var config = new TableConfig(new DbContextConfig(typeof(MockDbContext), null!), typeof(MockModel), "Models", 0);
|
||||
var explorer = new Mock<IContextExplorer>();
|
||||
var provider = new Mock<IServiceProvider>();
|
||||
var manager = new TableManager<MockModel>(dbContext.Object, config, explorer.Object, provider.Object);
|
||||
@@ -70,7 +70,7 @@ public class TableManagerTests {
|
||||
new MockModel { Id = 3, Name = "TestItem" }
|
||||
};
|
||||
var dbContext = CreateMockDbContext(data);
|
||||
var config = new TableConfig(new DbContextConfig(typeof(MockDbContext)), typeof(MockModel), "Models", 0);
|
||||
var config = new TableConfig(new DbContextConfig(typeof(MockDbContext), null!), typeof(MockModel), "Models", 0);
|
||||
config.Properties.Add(new PropertyConfig(typeof(MockModel).GetProperty("Name")!, config, 0)
|
||||
{ Searchable = true });
|
||||
var explorer = new Mock<IContextExplorer>();
|
||||
@@ -96,7 +96,7 @@ public class TableManagerTests {
|
||||
new MockModel { Id = 3, Name = "Item3" }
|
||||
};
|
||||
var dbContext = new MockDbContext();
|
||||
var config = new TableConfig(new DbContextConfig(typeof(MockDbContext)), typeof(MockModel), "Models", 0);
|
||||
var config = new TableConfig(new DbContextConfig(typeof(MockDbContext), null!), typeof(MockModel), "Models", 0);
|
||||
var explorer = new Mock<IContextExplorer>();
|
||||
var provider = new Mock<IServiceProvider>();
|
||||
var manager = new TableManager<MockModel>(dbContext, config, explorer.Object, provider.Object);
|
||||
@@ -118,7 +118,7 @@ public class TableManagerTests {
|
||||
new MockModel { Id = 2, Name = "Item2" }
|
||||
};
|
||||
var dbContext = CreateMockDbContext(data);
|
||||
var config = new TableConfig(new DbContextConfig(typeof(MockDbContext)), typeof(MockModel), "Models", 0);
|
||||
var config = new TableConfig(new DbContextConfig(typeof(MockDbContext), null!), typeof(MockModel), "Models", 0);
|
||||
var explorer = new Mock<IContextExplorer>();
|
||||
var provider = new Mock<IServiceProvider>();
|
||||
var manager = new TableManager<MockModel>(dbContext.Object, config, explorer.Object, provider.Object);
|
||||
@@ -139,7 +139,7 @@ public class TableManagerTests {
|
||||
new MockModel { Id = 1, Name = "Item1" }
|
||||
};
|
||||
var dbContext = CreateMockDbContext(data);
|
||||
var config = new TableConfig(new DbContextConfig(typeof(MockDbContext)), typeof(MockModel), "Models", 0);
|
||||
var config = new TableConfig(new DbContextConfig(typeof(MockDbContext), null!), typeof(MockModel), "Models", 0);
|
||||
var explorer = new Mock<IContextExplorer>();
|
||||
var provider = new Mock<IServiceProvider>();
|
||||
var manager = new TableManager<MockModel>(dbContext.Object, config, explorer.Object, provider.Object);
|
||||
@@ -156,7 +156,7 @@ public class TableManagerTests {
|
||||
// Arrange
|
||||
var data = new List<MockModel>();
|
||||
var dbContext = CreateMockDbContext(data);
|
||||
var config = new TableConfig(new DbContextConfig(typeof(MockDbContext)), typeof(MockModel), "Models", 0);
|
||||
var config = new TableConfig(new DbContextConfig(typeof(MockDbContext), null!), typeof(MockModel), "Models", 0);
|
||||
var explorer = new Mock<IContextExplorer>();
|
||||
var provider = new Mock<IServiceProvider>();
|
||||
var manager = new TableManager<MockModel>(dbContext.Object, config, explorer.Object, provider.Object);
|
||||
|
||||
Reference in New Issue
Block a user