Added web module tests
This commit is contained in:
103
.idea/.idea.HopFrame/.idea/workspace.xml
generated
103
.idea/.idea.HopFrame/.idea/workspace.xml
generated
@@ -10,20 +10,32 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="0648788e-7696-4e60-bf12-5d5601f33d8c" name="Changes" comment="">
|
<list default="true" id="0648788e-7696-4e60-bf12-5d5601f33d8c" name="Changes" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Services/DisplayPropertyTests.cs" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Web/Components/Dialogs/HopFrameEditorTests.cs" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Web/Components/Layout/HopFrameLayoutTests.cs" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Web/Components/Layout/HopFrameNavigationTests.cs" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Web/Components/Layout/HopFrameSideMenuTests.cs" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Web/Components/Pages/HopFrameHomeTests.cs" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Web/Components/Pages/HopFrameTablePageTests.cs" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Web/Helpers/EnumerableExtensions.cs" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Web/HopFrame.Tests.Web.csproj" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Web/Models/MyDbContext.cs" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Web/Models/MyTable.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.HopFrame/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.HopFrame/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/.idea.HopFrame/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.HopFrame/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Core/Config/PropertyConfig.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Core/Config/PropertyConfig.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/HopFrame.sln" beforeDir="false" afterPath="$PROJECT_DIR$/HopFrame.sln" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Core/Config/TableConfig.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Core/Config/TableConfig.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/HopFrame.Core/HopFrame.Core.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Core/HopFrame.Core.csproj" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Core/Services/Implementations/TableManager.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Core/Services/Implementations/TableManager.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Config/DbContextConfiguratorTests.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Core/Config/DbContextConfiguratorTests.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/HopFrame.Web.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/HopFrame.Web.csproj" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Config/HopFrameConfiguratorTests.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Core/Config/HopFrameConfiguratorTests.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/HopFrame.Web/ServiceCollectionExtensions.cs" beforeDir="false" afterPath="$PROJECT_DIR$/src/HopFrame.Web/ServiceCollectionExtensions.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Config/PropertyConfiguratorTests.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Core/Config/PropertyConfiguratorTests.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/testing/HopFrame.Testing/Program.cs" beforeDir="false" afterPath="$PROJECT_DIR$/testing/HopFrame.Testing/Program.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Config/TableConfiguratorTests.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Core/Config/TableConfiguratorTests.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Config/HopFrameConfiguratorTests.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Config/HopFrameConfiguratorTests.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/HopFrame.Core.Tests.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Core/HopFrame.Tests.Core.csproj" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Config/PropertyConfiguratorTests.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Config/PropertyConfiguratorTests.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Models/MockDbContext.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Core/Models/MockDbContext.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Config/TableConfiguratorTests.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Config/TableConfiguratorTests.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Models/MockModel.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Core/Models/MockModel.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Models/MockModel.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Models/MockModel.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Models/MockModel2.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Core/Models/MockModel2.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Models/MockModel2.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Models/MockModel2.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Models/QueryProvider.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Core/Models/QueryProvider.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Services/ContextExplorerTests.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Services/ContextExplorerTests.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Services/ContextExplorerTests.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Core/Services/ContextExplorerTests.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Services/DefaultAuthHandlerTests.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Core/Services/DefaultAuthHandlerTests.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Services/DisplayPropertyTests.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Core/Services/DisplayPropertyTests.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/tests/HopFrame.Core.Tests/Services/TableManagerTests.cs" beforeDir="false" afterPath="$PROJECT_DIR$/tests/HopFrame.Tests.Core/Services/TableManagerTests.cs" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -168,7 +180,8 @@
|
|||||||
<workItem from="1737120164342" duration="9351000" />
|
<workItem from="1737120164342" duration="9351000" />
|
||||||
<workItem from="1737199714142" duration="8344000" />
|
<workItem from="1737199714142" duration="8344000" />
|
||||||
<workItem from="1737208313207" duration="4612000" />
|
<workItem from="1737208313207" duration="4612000" />
|
||||||
<workItem from="1737281957060" duration="2760000" />
|
<workItem from="1737281957060" duration="3232000" />
|
||||||
|
<workItem from="1737293153907" duration="5484000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="Added basic configuration">
|
<task id="LOCAL-00001" summary="Added basic configuration">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
@@ -306,7 +319,15 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1737212497960</updated>
|
<updated>1737212497960</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="18" />
|
<task id="LOCAL-00018" summary="Added more tests">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1737285123218</created>
|
||||||
|
<option name="number" value="00018" />
|
||||||
|
<option name="presentableId" value="LOCAL-00018" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1737285123218</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="19" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
@@ -321,52 +342,33 @@
|
|||||||
<expand>
|
<expand>
|
||||||
<path>
|
<path>
|
||||||
<item name="rootNode" type="c53c71d1:RiderDotCoverCoverageTreeModel$RootNode" />
|
<item name="rootNode" type="c53c71d1:RiderDotCoverCoverageTreeModel$RootNode" />
|
||||||
<item name="Total 59% 577/1420" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
<item name="Total 61% 571/1454" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
||||||
</path>
|
</path>
|
||||||
<path>
|
<path>
|
||||||
<item name="rootNode" type="c53c71d1:RiderDotCoverCoverageTreeModel$RootNode" />
|
<item name="rootNode" type="c53c71d1:RiderDotCoverCoverageTreeModel$RootNode" />
|
||||||
<item name="Total 59% 577/1420" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
<item name="Total 61% 571/1454" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
||||||
<item name="Core 45% 407/741" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
<item name="Core 46% 401/743" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
||||||
</path>
|
</path>
|
||||||
<path>
|
<path>
|
||||||
<item name="rootNode" type="c53c71d1:RiderDotCoverCoverageTreeModel$RootNode" />
|
<item name="rootNode" type="c53c71d1:RiderDotCoverCoverageTreeModel$RootNode" />
|
||||||
<item name="Total 59% 577/1420" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
<item name="Total 61% 571/1454" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
||||||
<item name="Core 45% 407/741" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
<item name="Core 46% 401/743" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
||||||
<item name="HopFrame.Core 92% 31/365" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
<item name="HopFrame.Core 93% 25/367" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
||||||
</path>
|
</path>
|
||||||
<path>
|
<path>
|
||||||
<item name="rootNode" type="c53c71d1:RiderDotCoverCoverageTreeModel$RootNode" />
|
<item name="rootNode" type="c53c71d1:RiderDotCoverCoverageTreeModel$RootNode" />
|
||||||
<item name="Total 59% 577/1420" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
<item name="Total 61% 571/1454" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
||||||
<item name="Core 45% 407/741" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
<item name="Core 46% 401/743" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
||||||
<item name="HopFrame.Core 92% 31/365" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
<item name="HopFrame.Core 93% 25/367" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
||||||
<item name="HopFrame.Core 92% 31/365" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
<item name="HopFrame.Core 93% 25/367" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
||||||
</path>
|
</path>
|
||||||
<path>
|
<path>
|
||||||
<item name="rootNode" type="c53c71d1:RiderDotCoverCoverageTreeModel$RootNode" />
|
<item name="rootNode" type="c53c71d1:RiderDotCoverCoverageTreeModel$RootNode" />
|
||||||
<item name="Total 59% 577/1420" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
<item name="Total 61% 571/1454" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
||||||
<item name="Core 45% 407/741" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
<item name="Core 46% 401/743" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
||||||
<item name="HopFrame.Core 92% 31/365" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
<item name="HopFrame.Core 93% 25/367" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
||||||
<item name="HopFrame.Core 92% 31/365" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
<item name="HopFrame.Core 93% 25/367" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
||||||
<item name="Services.Implementations 93% 9/134" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
<item name="Services.Implementations 96% 5/136" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
||||||
</path>
|
|
||||||
<path>
|
|
||||||
<item name="rootNode" type="c53c71d1:RiderDotCoverCoverageTreeModel$RootNode" />
|
|
||||||
<item name="Total 59% 577/1420" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
|
||||||
<item name="Core 45% 407/741" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
|
||||||
<item name="HopFrame.Core 92% 31/365" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
|
||||||
<item name="HopFrame.Core 92% 31/365" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
|
||||||
<item name="Services.Implementations 93% 9/134" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
|
||||||
<item name="TableManager<TModel> 87% 8/63" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
|
||||||
</path>
|
|
||||||
<path>
|
|
||||||
<item name="rootNode" type="c53c71d1:RiderDotCoverCoverageTreeModel$RootNode" />
|
|
||||||
<item name="Total 59% 577/1420" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
|
||||||
<item name="Core 45% 407/741" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
|
||||||
<item name="HopFrame.Core 92% 31/365" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
|
||||||
<item name="HopFrame.Core 92% 31/365" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
|
||||||
<item name="Services.Implementations 93% 9/134" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
|
||||||
<item name="TableManager<TModel> 87% 8/63" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
|
||||||
<item name="DisplayProperty(object,PropertyConfig,object) 73% 7/26" type="8b8fad3a:RiderDotCoverCoverageTreeNode" />
|
|
||||||
</path>
|
</path>
|
||||||
</expand>
|
</expand>
|
||||||
<select />
|
<select />
|
||||||
@@ -393,6 +395,7 @@
|
|||||||
<MESSAGE value="Addressed all build warnings" />
|
<MESSAGE value="Addressed all build warnings" />
|
||||||
<MESSAGE value="Added documentation for the configurators and service extensions methods" />
|
<MESSAGE value="Added documentation for the configurators and service extensions methods" />
|
||||||
<MESSAGE value="Created tests for the core module" />
|
<MESSAGE value="Created tests for the core module" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Created tests for the core module" />
|
<MESSAGE value="Added more tests" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="Added more tests" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -12,7 +12,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HopFrame.Testing", "testing
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{141928CB-5977-4285-A986-5BD785F2883C}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{141928CB-5977-4285-A986-5BD785F2883C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HopFrame.Core.Tests", "tests\HopFrame.Core.Tests\HopFrame.Core.Tests.csproj", "{2E2D29E0-53FA-462D-B4D2-4678CD106E29}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HopFrame.Tests.Core", "tests\HopFrame.Tests.Core\HopFrame.Tests.Core.csproj", "{2E2D29E0-53FA-462D-B4D2-4678CD106E29}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HopFrame.Tests.Web", "tests\HopFrame.Tests.Web\HopFrame.Tests.Web.csproj", "{7AB4F4FF-E938-4A40-A7EB-7B2063262896}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -24,6 +26,7 @@ Global
|
|||||||
{8E59F398-184A-47C9-AAA2-3E0FFD775ABF} = {7E4AAFB3-9762-4F42-86DF-5A3194FDC243}
|
{8E59F398-184A-47C9-AAA2-3E0FFD775ABF} = {7E4AAFB3-9762-4F42-86DF-5A3194FDC243}
|
||||||
{58490069-51DF-454C-8B54-7FB7D4BDFF81} = {9EB7FDBD-49C2-4872-9666-6F7AEBA541B2}
|
{58490069-51DF-454C-8B54-7FB7D4BDFF81} = {9EB7FDBD-49C2-4872-9666-6F7AEBA541B2}
|
||||||
{2E2D29E0-53FA-462D-B4D2-4678CD106E29} = {141928CB-5977-4285-A986-5BD785F2883C}
|
{2E2D29E0-53FA-462D-B4D2-4678CD106E29} = {141928CB-5977-4285-A986-5BD785F2883C}
|
||||||
|
{7AB4F4FF-E938-4A40-A7EB-7B2063262896} = {141928CB-5977-4285-A986-5BD785F2883C}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{4BFE21C2-EAAC-4662-8B97-500836651B2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{4BFE21C2-EAAC-4662-8B97-500836651B2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
@@ -42,5 +45,9 @@ Global
|
|||||||
{2E2D29E0-53FA-462D-B4D2-4678CD106E29}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{2E2D29E0-53FA-462D-B4D2-4678CD106E29}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{2E2D29E0-53FA-462D-B4D2-4678CD106E29}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{2E2D29E0-53FA-462D-B4D2-4678CD106E29}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{2E2D29E0-53FA-462D-B4D2-4678CD106E29}.Release|Any CPU.Build.0 = Release|Any CPU
|
{2E2D29E0-53FA-462D-B4D2-4678CD106E29}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{7AB4F4FF-E938-4A40-A7EB-7B2063262896}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{7AB4F4FF-E938-4A40-A7EB-7B2063262896}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{7AB4F4FF-E938-4A40-A7EB-7B2063262896}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{7AB4F4FF-E938-4A40-A7EB-7B2063262896}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
|
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
|
||||||
<_Parameter1>HopFrame.Core.Tests</_Parameter1>
|
<_Parameter1>HopFrame.Tests.Core</_Parameter1>
|
||||||
</AssemblyAttribute>
|
</AssemblyAttribute>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using HopFrame.Core.Config;
|
using HopFrame.Core.Config;
|
||||||
using HopFrame.Core.Tests.Models;
|
using HopFrame.Tests.Core.Models;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
|
||||||
namespace HopFrame.Core.Tests.Config;
|
namespace HopFrame.Tests.Core.Config;
|
||||||
|
|
||||||
public class DbContextConfiguratorTests {
|
public class DbContextConfiguratorTests {
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using HopFrame.Core.Config;
|
using HopFrame.Core.Config;
|
||||||
using HopFrame.Core.Tests.Models;
|
using HopFrame.Tests.Core.Models;
|
||||||
|
|
||||||
namespace HopFrame.Core.Tests.Config;
|
namespace HopFrame.Tests.Core.Config;
|
||||||
|
|
||||||
public class HopFrameConfiguratorTests {
|
public class HopFrameConfiguratorTests {
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using HopFrame.Core.Config;
|
using HopFrame.Core.Config;
|
||||||
using HopFrame.Core.Tests.Models;
|
using HopFrame.Tests.Core.Models;
|
||||||
|
|
||||||
namespace HopFrame.Core.Tests.Config;
|
namespace HopFrame.Tests.Core.Config;
|
||||||
|
|
||||||
public class PropertyConfiguratorTests {
|
public class PropertyConfiguratorTests {
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using HopFrame.Core.Config;
|
using HopFrame.Core.Config;
|
||||||
using HopFrame.Core.Tests.Models;
|
using HopFrame.Tests.Core.Models;
|
||||||
|
|
||||||
namespace HopFrame.Core.Tests.Config;
|
namespace HopFrame.Tests.Core.Config;
|
||||||
|
|
||||||
public class TableConfiguratorTests {
|
public class TableConfiguratorTests {
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace HopFrame.Core.Tests.Models;
|
namespace HopFrame.Tests.Core.Models;
|
||||||
|
|
||||||
// A mock DbContext for testing purposes
|
// A mock DbContext for testing purposes
|
||||||
public class MockDbContext : DbContext {
|
public class MockDbContext : DbContext {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace HopFrame.Core.Tests.Models;
|
namespace HopFrame.Tests.Core.Models;
|
||||||
|
|
||||||
// A mock model for testing purposes
|
// A mock model for testing purposes
|
||||||
public class MockModel {
|
public class MockModel {
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace HopFrame.Core.Tests.Models;
|
namespace HopFrame.Tests.Core.Models;
|
||||||
|
|
||||||
public class MockModel2 {
|
public class MockModel2 {
|
||||||
[Key]
|
[Key]
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using Microsoft.EntityFrameworkCore.Query;
|
using Microsoft.EntityFrameworkCore.Query;
|
||||||
|
|
||||||
namespace HopFrame.Core.Tests.Models;
|
namespace HopFrame.Tests.Core.Models;
|
||||||
|
|
||||||
// A mock implementation for async query provider
|
// A mock implementation for async query provider
|
||||||
internal class TestAsyncQueryProvider<TEntity> : IAsyncQueryProvider {
|
internal class TestAsyncQueryProvider<TEntity> : IAsyncQueryProvider {
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
using HopFrame.Core.Config;
|
using HopFrame.Core.Config;
|
||||||
using HopFrame.Core.Services.Implementations;
|
using HopFrame.Core.Services.Implementations;
|
||||||
using HopFrame.Core.Tests.Models;
|
using HopFrame.Tests.Core.Models;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
|
||||||
namespace HopFrame.Core.Tests.Services;
|
namespace HopFrame.Tests.Core.Services;
|
||||||
|
|
||||||
public class ContextExplorerTests {
|
public class ContextExplorerTests {
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using HopFrame.Core.Services.Implementations;
|
using HopFrame.Core.Services.Implementations;
|
||||||
|
|
||||||
namespace HopFrame.Core.Tests.Services;
|
namespace HopFrame.Tests.Core.Services;
|
||||||
|
|
||||||
public class DefaultAuthHandlerTests {
|
public class DefaultAuthHandlerTests {
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
using HopFrame.Core.Config;
|
using HopFrame.Core.Config;
|
||||||
using HopFrame.Core.Services;
|
using HopFrame.Core.Services;
|
||||||
using HopFrame.Core.Services.Implementations;
|
using HopFrame.Core.Services.Implementations;
|
||||||
using HopFrame.Core.Tests.Models;
|
using HopFrame.Tests.Core.Models;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
|
||||||
namespace HopFrame.Core.Tests.Services;
|
namespace HopFrame.Tests.Core.Services;
|
||||||
|
|
||||||
public class DisplayPropertyTests {
|
public class DisplayPropertyTests {
|
||||||
private readonly Mock<IServiceProvider> _providerMock;
|
private readonly Mock<IServiceProvider> _providerMock;
|
||||||
@@ -3,11 +3,11 @@
|
|||||||
using HopFrame.Core.Config;
|
using HopFrame.Core.Config;
|
||||||
using HopFrame.Core.Services;
|
using HopFrame.Core.Services;
|
||||||
using HopFrame.Core.Services.Implementations;
|
using HopFrame.Core.Services.Implementations;
|
||||||
using HopFrame.Core.Tests.Models;
|
using HopFrame.Tests.Core.Models;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Moq;
|
using Moq;
|
||||||
|
|
||||||
namespace HopFrame.Core.Tests.Services;
|
namespace HopFrame.Tests.Core.Services;
|
||||||
|
|
||||||
public class TableManagerTests {
|
public class TableManagerTests {
|
||||||
private Mock<DbContext> CreateMockDbContext<TModel>(List<TModel> data) where TModel : class {
|
private Mock<DbContext> CreateMockDbContext<TModel>(List<TModel> data) where TModel : class {
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
using Bunit;
|
||||||
|
using HopFrame.Core.Config;
|
||||||
|
using HopFrame.Core.Services;
|
||||||
|
using HopFrame.Tests.Web.Models;
|
||||||
|
using HopFrame.Web;
|
||||||
|
using HopFrame.Web.Components.Dialogs;
|
||||||
|
using HopFrame.Web.Models;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.FluentUI.AspNetCore.Components;
|
||||||
|
using Moq;
|
||||||
|
|
||||||
|
namespace HopFrame.Tests.Web.Components.Dialogs;
|
||||||
|
|
||||||
|
public class HopFrameEditorTests : TestContext {
|
||||||
|
[Fact]
|
||||||
|
public void Renders_Properties_Correctly() {
|
||||||
|
// Arrange
|
||||||
|
var contextExplorerMock = new Mock<IContextExplorer>();
|
||||||
|
var authHandlerMock = new Mock<IHopFrameAuthHandler>();
|
||||||
|
var dialogServiceMock = new Mock<IDialogService>();
|
||||||
|
var toastServiceMock = new Mock<IToastService>();
|
||||||
|
var serviceProviderMock = new Mock<IServiceProvider>();
|
||||||
|
var contextConfig = new DbContextConfig(typeof(MyDbContext));
|
||||||
|
var tableConfig = new TableConfig(contextConfig, typeof(MyTable), "Table1", 0) {
|
||||||
|
DisplayName = "Table1",
|
||||||
|
ViewPolicy = "Policy1"
|
||||||
|
};
|
||||||
|
contextConfig.Tables.Add(tableConfig);
|
||||||
|
var config = new HopFrameConfig() {
|
||||||
|
Contexts = { contextConfig }
|
||||||
|
};
|
||||||
|
|
||||||
|
contextExplorerMock.Setup(e => e.GetTable("Table1")).Returns(tableConfig);
|
||||||
|
contextExplorerMock.Setup(e => e.GetTableManager("Table1")).Returns(Mock.Of<ITableManager>());
|
||||||
|
authHandlerMock.Setup(h => h.IsAuthenticatedAsync(It.IsAny<string>())).ReturnsAsync(true);
|
||||||
|
|
||||||
|
Services.AddHopFrame(config);
|
||||||
|
Services.AddSingleton(contextExplorerMock.Object);
|
||||||
|
Services.AddSingleton(authHandlerMock.Object);
|
||||||
|
Services.AddSingleton(dialogServiceMock.Object);
|
||||||
|
Services.AddSingleton(toastServiceMock.Object);
|
||||||
|
Services.AddSingleton(serviceProviderMock.Object);
|
||||||
|
|
||||||
|
JSInterop.Mode = JSRuntimeMode.Loose;
|
||||||
|
|
||||||
|
var dialogData = new EditorDialogData(tableConfig, new MyTable());
|
||||||
|
var dialog = new FluentDialog() {
|
||||||
|
Instance = new DialogInstance(typeof(HopFrameEditor), new DialogParameters(), dialogData)
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var cut = RenderComponent<HopFrameEditor>(parameters => parameters
|
||||||
|
.Add(p => p.Content, dialogData)
|
||||||
|
.Add(p => p.Dialog, dialog));
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
var dialogBody = cut.FindComponent<FluentDialogBody>();
|
||||||
|
Assert.NotNull(dialogBody);
|
||||||
|
|
||||||
|
var textFields = cut.FindComponents<FluentNumberField<double>>();
|
||||||
|
Assert.Single(textFields);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
using Bunit;
|
||||||
|
using Bunit.TestDoubles;
|
||||||
|
using HopFrame.Core.Config;
|
||||||
|
using HopFrame.Core.Services;
|
||||||
|
using HopFrame.Web;
|
||||||
|
using HopFrame.Web.Components.Layout;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.FluentUI.AspNetCore.Components;
|
||||||
|
using Moq;
|
||||||
|
|
||||||
|
namespace HopFrame.Tests.Web.Components.Layout;
|
||||||
|
|
||||||
|
public class HopFrameLayoutTests : TestContext {
|
||||||
|
[Fact]
|
||||||
|
public void Renders_HopFrameLayout_Components() {
|
||||||
|
// Arrange
|
||||||
|
var authHandlerMock = new Mock<IHopFrameAuthHandler>();
|
||||||
|
var config = new HopFrameConfig {
|
||||||
|
DisplayUserInfo = true,
|
||||||
|
BasePolicy = "SomePolicy",
|
||||||
|
LoginPageRewrite = "/login"
|
||||||
|
};
|
||||||
|
|
||||||
|
authHandlerMock.Setup(h => h.IsAuthenticatedAsync("SomePolicy"))
|
||||||
|
.ReturnsAsync(true);
|
||||||
|
|
||||||
|
Services.AddSingleton(authHandlerMock.Object);
|
||||||
|
Services.AddHopFrame(config);
|
||||||
|
|
||||||
|
JSInterop.Mode = JSRuntimeMode.Loose;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var cut = RenderComponent<HopFrameLayout>();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
var header = cut.FindComponent<FluentHeader>();
|
||||||
|
Assert.NotNull(header);
|
||||||
|
|
||||||
|
var navigation = cut.FindComponent<HopFrameNavigation>();
|
||||||
|
Assert.NotNull(navigation);
|
||||||
|
|
||||||
|
var sideMenu = cut.FindComponent<HopFrameSideMenu>();
|
||||||
|
Assert.NotNull(sideMenu);
|
||||||
|
|
||||||
|
var footer = cut.FindComponent<FluentFooter>();
|
||||||
|
Assert.NotNull(footer);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Redirects_To_Login_When_Not_Authorized() {
|
||||||
|
// Arrange
|
||||||
|
var authHandlerMock = new Mock<IHopFrameAuthHandler>();
|
||||||
|
var navMock = new FakeNavigationManager(this);
|
||||||
|
var config = new HopFrameConfig {
|
||||||
|
DisplayUserInfo = true,
|
||||||
|
BasePolicy = "SomePolicy",
|
||||||
|
LoginPageRewrite = "/login"
|
||||||
|
};
|
||||||
|
|
||||||
|
authHandlerMock.Setup(h => h.IsAuthenticatedAsync("SomePolicy"))
|
||||||
|
.ReturnsAsync(false);
|
||||||
|
|
||||||
|
Services.AddSingleton(navMock);
|
||||||
|
Services.AddHopFrame(config);
|
||||||
|
|
||||||
|
JSInterop.Mode = JSRuntimeMode.Loose;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var cut = RenderComponent<HopFrameLayout>();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
// TODO: check if uri matches
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
using Bunit;
|
||||||
|
using HopFrame.Core.Config;
|
||||||
|
using HopFrame.Core.Services;
|
||||||
|
using HopFrame.Web;
|
||||||
|
using HopFrame.Web.Components.Layout;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.FluentUI.AspNetCore.Components;
|
||||||
|
using Moq;
|
||||||
|
|
||||||
|
namespace HopFrame.Tests.Web.Components.Layout;
|
||||||
|
|
||||||
|
public class HopFrameNavigationTests : TestContext {
|
||||||
|
[Fact]
|
||||||
|
public void Renders_HopFrameNavigation_Components() {
|
||||||
|
// Arrange
|
||||||
|
var authHandlerMock = new Mock<IHopFrameAuthHandler>();
|
||||||
|
var config = new HopFrameConfig {
|
||||||
|
DisplayUserInfo = true
|
||||||
|
};
|
||||||
|
|
||||||
|
authHandlerMock.Setup(h => h.GetCurrentUserDisplayNameAsync())
|
||||||
|
.ReturnsAsync("John Doe");
|
||||||
|
|
||||||
|
Services.AddSingleton(authHandlerMock.Object);
|
||||||
|
Services.AddHopFrame(config);
|
||||||
|
|
||||||
|
JSInterop.Mode = JSRuntimeMode.Loose;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var cut = RenderComponent<HopFrameNavigation>();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
var header = cut.FindComponent<FluentHeader>();
|
||||||
|
Assert.NotNull(header);
|
||||||
|
|
||||||
|
var persona = cut.FindComponent<FluentPersona>();
|
||||||
|
Assert.NotNull(persona);
|
||||||
|
Assert.Equal("John Doe", persona.Instance.Name);
|
||||||
|
Assert.Equal("JD", persona.Instance.Initials);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Renders_HopFrameNavigation_WithoutPersona() {
|
||||||
|
// Arrange
|
||||||
|
var authHandlerMock = new Mock<IHopFrameAuthHandler>();
|
||||||
|
var config = new HopFrameConfig {
|
||||||
|
DisplayUserInfo = false
|
||||||
|
};
|
||||||
|
|
||||||
|
authHandlerMock.Setup(h => h.GetCurrentUserDisplayNameAsync())
|
||||||
|
.ReturnsAsync("John Doe");
|
||||||
|
|
||||||
|
Services.AddSingleton(authHandlerMock.Object);
|
||||||
|
Services.AddHopFrame(config);
|
||||||
|
|
||||||
|
JSInterop.Mode = JSRuntimeMode.Loose;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var cut = RenderComponent<HopFrameNavigation>();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
var header = cut.FindComponent<FluentHeader>();
|
||||||
|
Assert.NotNull(header);
|
||||||
|
Assert.False(cut.HasComponent<FluentPersona>());
|
||||||
|
|
||||||
|
authHandlerMock.Verify(h => h.GetCurrentUserDisplayNameAsync(), Times.Never);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
using HopFrame.Core.Config;
|
||||||
|
using HopFrame.Core.Services;
|
||||||
|
using Moq;
|
||||||
|
using Bunit;
|
||||||
|
using HopFrame.Tests.Web.Models;
|
||||||
|
using HopFrame.Web;
|
||||||
|
using HopFrame.Web.Components.Layout;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.FluentUI.AspNetCore.Components;
|
||||||
|
|
||||||
|
namespace HopFrame.Tests.Web.Components.Layout;
|
||||||
|
|
||||||
|
public class HopFrameSideMenuTests : TestContext {
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Renders_FluentAppBar_Components() {
|
||||||
|
// Arrange
|
||||||
|
var contextExplorerMock = new Mock<IContextExplorer>();
|
||||||
|
var authHandlerMock = new Mock<IHopFrameAuthHandler>();
|
||||||
|
var contextConfig = new DbContextConfig(typeof(MyDbContext));
|
||||||
|
var tableConfigs = new List<TableConfig> {
|
||||||
|
new (contextConfig, typeof(MyTable), "Table1", 0),
|
||||||
|
new (contextConfig, typeof(MyTable2), "Table2", 1)
|
||||||
|
};
|
||||||
|
var config = new HopFrameConfig {
|
||||||
|
Contexts = { contextConfig }
|
||||||
|
};
|
||||||
|
|
||||||
|
contextExplorerMock.Setup(e => e.GetTables()).Returns(tableConfigs);
|
||||||
|
authHandlerMock.Setup(h => h.IsAuthenticatedAsync(null))
|
||||||
|
.ReturnsAsync(true);
|
||||||
|
|
||||||
|
Services.AddSingleton(contextExplorerMock.Object);
|
||||||
|
Services.AddSingleton(authHandlerMock.Object);
|
||||||
|
Services.AddHopFrame(config);
|
||||||
|
|
||||||
|
JSInterop.Mode = JSRuntimeMode.Loose;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var cut = RenderComponent<HopFrameSideMenu>();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
var items = cut.FindComponents<FluentAppBarItem>();
|
||||||
|
Assert.Equal(tableConfigs.Count + 1, items.Count);
|
||||||
|
Assert.Contains(items, item => item.Instance.Text.Equals("Table1"));
|
||||||
|
Assert.Contains(items, item => item.Instance.Text.Equals("Table2"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
using Bunit;
|
||||||
|
using HopFrame.Core.Config;
|
||||||
|
using HopFrame.Core.Services;
|
||||||
|
using HopFrame.Tests.Web.Models;
|
||||||
|
using HopFrame.Web;
|
||||||
|
using HopFrame.Web.Components.Pages;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.FluentUI.AspNetCore.Components;
|
||||||
|
using Moq;
|
||||||
|
|
||||||
|
namespace HopFrame.Tests.Web.Components.Pages;
|
||||||
|
|
||||||
|
public class HopFrameHomeTests : TestContext {
|
||||||
|
[Fact]
|
||||||
|
public void Renders_Table_Cards_Correctly() {
|
||||||
|
// Arrange
|
||||||
|
var contextExplorerMock = new Mock<IContextExplorer>();
|
||||||
|
var authHandlerMock = new Mock<IHopFrameAuthHandler>();
|
||||||
|
var contextConfig = new DbContextConfig(typeof(MyDbContext));
|
||||||
|
var tableConfigs = new List<TableConfig> {
|
||||||
|
new TableConfig(contextConfig, typeof(MyTable), "Table1", 0) {
|
||||||
|
DisplayName = "Table1",
|
||||||
|
ViewPolicy = "Policy1",
|
||||||
|
Description = "Description1"
|
||||||
|
},
|
||||||
|
new TableConfig(contextConfig, typeof(MyTable2), "Table2", 1) {
|
||||||
|
DisplayName = "Table2",
|
||||||
|
ViewPolicy = "Policy2",
|
||||||
|
Description = "Description2"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
contextConfig.Tables.AddRange(tableConfigs);
|
||||||
|
var config = new HopFrameConfig() {
|
||||||
|
Contexts = { contextConfig }
|
||||||
|
};
|
||||||
|
|
||||||
|
contextExplorerMock.Setup(e => e.GetTables()).Returns(tableConfigs);
|
||||||
|
authHandlerMock.Setup(h => h.IsAuthenticatedAsync(It.IsAny<string>()))
|
||||||
|
.ReturnsAsync(true);
|
||||||
|
|
||||||
|
Services.AddHopFrame(config);
|
||||||
|
Services.AddSingleton(contextExplorerMock.Object);
|
||||||
|
Services.AddSingleton(authHandlerMock.Object);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var cut = RenderComponent<HopFrameHome>();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
var cards = cut.FindComponents<FluentCard>();
|
||||||
|
Assert.Equal(2, cards.Count);
|
||||||
|
|
||||||
|
Assert.Contains(cards, card => card.Markup.Contains("Table1"));
|
||||||
|
Assert.Contains(cards, card => card.Markup.Contains("Description1"));
|
||||||
|
Assert.Contains(cards, card => card.Markup.Contains("Policy1"));
|
||||||
|
Assert.Contains(cards, card => card.Markup.Contains("Open"));
|
||||||
|
|
||||||
|
Assert.Contains(cards, card => card.Markup.Contains("Table2"));
|
||||||
|
Assert.Contains(cards, card => card.Markup.Contains("Description2"));
|
||||||
|
Assert.Contains(cards, card => card.Markup.Contains("Policy2"));
|
||||||
|
Assert.Contains(cards, card => card.Markup.Contains("Open"));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
using Bunit;
|
||||||
|
using HopFrame.Core.Config;
|
||||||
|
using HopFrame.Core.Services;
|
||||||
|
using HopFrame.Tests.Web.Helpers;
|
||||||
|
using HopFrame.Tests.Web.Models;
|
||||||
|
using HopFrame.Web;
|
||||||
|
using HopFrame.Web.Components.Pages;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.FluentUI.AspNetCore.Components;
|
||||||
|
using Microsoft.JSInterop;
|
||||||
|
using Moq;
|
||||||
|
|
||||||
|
namespace HopFrame.Tests.Web.Components.Pages;
|
||||||
|
|
||||||
|
public class HopFrameTablePageTests : TestContext {
|
||||||
|
[Fact]
|
||||||
|
public void Renders_Table_Correctly() {
|
||||||
|
// Arrange
|
||||||
|
var contextExplorerMock = new Mock<IContextExplorer>();
|
||||||
|
var authHandlerMock = new Mock<IHopFrameAuthHandler>();
|
||||||
|
var dialogServiceMock = new Mock<IDialogService>();
|
||||||
|
var contextConfig = new DbContextConfig(typeof(MyDbContext));
|
||||||
|
var managerMock = new Mock<ITableManager>();
|
||||||
|
var tableConfig = new TableConfig(contextConfig, typeof(MyTable), "Table1", 0) {
|
||||||
|
DisplayName = "Table1",
|
||||||
|
ViewPolicy = "Policy1"
|
||||||
|
};
|
||||||
|
contextConfig.Tables.Add(tableConfig);
|
||||||
|
var config = new HopFrameConfig() {
|
||||||
|
Contexts = { contextConfig }
|
||||||
|
};
|
||||||
|
|
||||||
|
contextExplorerMock.Setup(e => e.GetTable("Table1")).Returns(tableConfig);
|
||||||
|
contextExplorerMock.Setup(e => e.GetTableManager("Table1")).Returns(managerMock.Object);
|
||||||
|
authHandlerMock.Setup(h => h.IsAuthenticatedAsync(It.IsAny<string>())).ReturnsAsync(true);
|
||||||
|
managerMock.Setup(m => m.LoadPage(It.IsAny<int>(), It.IsAny<int>())).Returns(Enumerable.Empty<object>().AsAsyncQueryable());
|
||||||
|
|
||||||
|
Services.AddHopFrame(config);
|
||||||
|
Services.AddSingleton(contextExplorerMock.Object);
|
||||||
|
Services.AddSingleton(authHandlerMock.Object);
|
||||||
|
Services.AddSingleton(dialogServiceMock.Object);
|
||||||
|
|
||||||
|
JSInterop.Mode = JSRuntimeMode.Loose;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var cut = RenderComponent<HopFrameTablePage>(parameters => parameters
|
||||||
|
.Add(p => p.TableDisplayName, "Table1"));
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
var toolbar = cut.Find("fluent-toolbar");
|
||||||
|
Assert.NotNull(toolbar);
|
||||||
|
|
||||||
|
var searchBox = cut.Find("fluent-search");
|
||||||
|
Assert.NotNull(searchBox);
|
||||||
|
|
||||||
|
var dataGrid = cut.FindComponent<FluentDataGrid<object>>();
|
||||||
|
Assert.NotNull(dataGrid);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Displays_Properties_Correctly() {
|
||||||
|
// Arrange
|
||||||
|
var contextExplorerMock = new Mock<IContextExplorer>();
|
||||||
|
var authHandlerMock = new Mock<IHopFrameAuthHandler>();
|
||||||
|
var dialogServiceMock = new Mock<IDialogService>();
|
||||||
|
var contextConfig = new DbContextConfig(typeof(MyDbContext));
|
||||||
|
var tableConfig = new TableConfig(contextConfig, typeof(MyTable), "Table1", 0) {
|
||||||
|
DisplayName = "Table1",
|
||||||
|
ViewPolicy = "Policy1"
|
||||||
|
};
|
||||||
|
|
||||||
|
var tableManagerMock = new Mock<ITableManager>();
|
||||||
|
var items = new List<object> { new MyTable(), new MyTable() };
|
||||||
|
tableManagerMock.Setup(m => m.LoadPage(It.IsAny<int>(), It.IsAny<int>())).Returns(items.AsAsyncQueryable());
|
||||||
|
|
||||||
|
contextExplorerMock.Setup(e => e.GetTable("Table1")).Returns(tableConfig);
|
||||||
|
contextExplorerMock.Setup(e => e.GetTableManager("Table1")).Returns(tableManagerMock.Object);
|
||||||
|
authHandlerMock.Setup(h => h.IsAuthenticatedAsync(It.IsAny<string>())).ReturnsAsync(true);
|
||||||
|
|
||||||
|
Services.AddHopFrame(new HopFrameConfig());
|
||||||
|
Services.AddSingleton(contextExplorerMock.Object);
|
||||||
|
Services.AddSingleton(authHandlerMock.Object);
|
||||||
|
Services.AddSingleton(dialogServiceMock.Object);
|
||||||
|
|
||||||
|
JSInterop.Mode = JSRuntimeMode.Loose;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var cut = RenderComponent<HopFrameTablePage>(parameters => parameters
|
||||||
|
.Add(p => p.TableDisplayName, "Table1"));
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
var dataGridItems = cut.FindComponents<PropertyColumn<object, string>>();
|
||||||
|
Assert.Single(dataGridItems);
|
||||||
|
Assert.Equal(nameof(MyTable.Id), dataGridItems[0].Instance.Title);
|
||||||
|
}
|
||||||
|
}
|
||||||
39
tests/HopFrame.Tests.Web/Helpers/EnumerableExtensions.cs
Normal file
39
tests/HopFrame.Tests.Web/Helpers/EnumerableExtensions.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using Microsoft.EntityFrameworkCore.Query.Internal;
|
||||||
|
|
||||||
|
namespace HopFrame.Tests.Web.Helpers;
|
||||||
|
|
||||||
|
public static class EnumerableExtensions {
|
||||||
|
|
||||||
|
public static AsyncQueryable AsAsyncQueryable(this IEnumerable<object> enumerable) {
|
||||||
|
return new AsyncQueryable(enumerable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AsyncQueryable(IEnumerable<object> enumerable) : IQueryable<object>, IAsyncEnumerable<object> {
|
||||||
|
public IEnumerator<object> GetEnumerator() {
|
||||||
|
return enumerable.GetEnumerator();
|
||||||
|
}
|
||||||
|
|
||||||
|
IEnumerator IEnumerable.GetEnumerator() {
|
||||||
|
return GetEnumerator();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type ElementType { get; } = typeof(object);
|
||||||
|
|
||||||
|
public Expression Expression { get; }
|
||||||
|
|
||||||
|
public IQueryProvider Provider { get; }
|
||||||
|
|
||||||
|
public IAsyncEnumerator<object> GetAsyncEnumerator(CancellationToken cancellationToken = new CancellationToken()) {
|
||||||
|
return Enumerate().GetAsyncEnumerator(cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async IAsyncEnumerable<object> Enumerate() {
|
||||||
|
foreach (var o in enumerable) {
|
||||||
|
yield return o;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
29
tests/HopFrame.Tests.Web/HopFrame.Tests.Web.csproj
Normal file
29
tests/HopFrame.Tests.Web/HopFrame.Tests.Web.csproj
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="bunit" Version="1.38.5" />
|
||||||
|
<PackageReference Include="coverlet.collector" Version="6.0.2"/>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1"/>
|
||||||
|
<PackageReference Include="Moq" Version="4.20.72" />
|
||||||
|
<PackageReference Include="xunit" Version="2.9.2"/>
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Using Include="Xunit"/>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\..\src\HopFrame.Core\HopFrame.Core.csproj" />
|
||||||
|
<ProjectReference Include="..\..\src\HopFrame.Web\HopFrame.Web.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
12
tests/HopFrame.Tests.Web/Models/MyDbContext.cs
Normal file
12
tests/HopFrame.Tests.Web/Models/MyDbContext.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace HopFrame.Tests.Web.Models;
|
||||||
|
|
||||||
|
public class MyDbContext : DbContext {
|
||||||
|
public DbSet<MyTable> Table1 { get; set; }
|
||||||
|
public DbSet<MyTable2> Table2 { get; set; }
|
||||||
|
|
||||||
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
|
||||||
|
optionsBuilder.UseInMemoryDatabase(nameof(MyDbContext));
|
||||||
|
}
|
||||||
|
}
|
||||||
14
tests/HopFrame.Tests.Web/Models/MyTable.cs
Normal file
14
tests/HopFrame.Tests.Web/Models/MyTable.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace HopFrame.Tests.Web.Models;
|
||||||
|
|
||||||
|
public class MyTable {
|
||||||
|
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MyTable2 {
|
||||||
|
[Key]
|
||||||
|
public string Id { get; set; }
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user