From aa1468d71691c2b0856dd405eeec275a2f784d6b Mon Sep 17 00:00:00 2001
From: Luthetus <45454132+huntercfreeman@users.noreply.github.com>
Date: Wed, 1 May 2024 19:07:52 -0400
Subject: [PATCH] TreeView constructor test progress
---
.../FileSystems/Models/IAbsolutePath.cs | 17 +++
.../FileSystems/Models/IRelativePath.cs | 17 +++
Source/Tests/Ide/Basis/IdeTestBase.cs | 122 ++++++++++++++++++
.../Models/TreeViewAbsolutePathTests.cs | 33 ++++-
.../TreeViewCSharpProjectDependenciesTests.cs | 36 +++++-
...CSharpProjectNugetPackageReferenceTests.cs | 36 +++++-
...SharpProjectNugetPackageReferencesTests.cs | 36 +++++-
...iewCSharpProjectToProjectReferenceTests.cs | 38 +++++-
...ewCSharpProjectToProjectReferencesTests.cs | 36 +++++-
.../Models/TreeViewCompilerServiceTests.cs | 35 ++++-
.../Models/TreeViewGitFileTests.cs | 32 ++++-
.../Models/TreeViewMarkupStringTests.cs | 33 ++++-
.../Models/TreeViewNamespacePathTests.cs | 36 +++++-
.../Models/TreeViewProjectTestModelTests.cs | 34 ++++-
.../Models/TreeViewReflectionWithViewTests.cs | 34 ++++-
.../Models/TreeViewSolutionFolderTests.cs | 44 ++++++-
.../Models/TreeViewSolutionTests.cs | 42 +++++-
.../Models/TreeViewSpinnerTests.cs | 30 ++++-
.../Models/TreeViewStringFragmentTests.cs | 29 ++++-
19 files changed, 688 insertions(+), 32 deletions(-)
create mode 100644 Source/Tests/Ide/Basis/IdeTestBase.cs
diff --git a/Source/Lib/Common/FileSystems/Models/IAbsolutePath.cs b/Source/Lib/Common/FileSystems/Models/IAbsolutePath.cs
index bd8434b49..c76414393 100644
--- a/Source/Lib/Common/FileSystems/Models/IAbsolutePath.cs
+++ b/Source/Lib/Common/FileSystems/Models/IAbsolutePath.cs
@@ -4,4 +4,21 @@ public interface IAbsolutePath : IPath
{
public IFileSystemDrive? RootDrive { get; }
public bool IsRootDirectory { get; }
+
+ ///
+ /// One might prefer instead
+ /// of this method.
+ ///
+ /// This version adds an extra function invocation for no reason. To use
+ /// may be a negligible
+ /// optimization however.
+ ///
+ /// Keep this method here, it provides more clear documentation on how to create an instance
+ /// of . Having to invoke a method on the
+ /// is a bit hard to find.
+ ///
+ public static IAbsolutePath Factory(string path, bool isDirectory, IEnvironmentProvider environmentProvider)
+ {
+ return environmentProvider.AbsolutePathFactory(path, isDirectory);
+ }
}
diff --git a/Source/Lib/Common/FileSystems/Models/IRelativePath.cs b/Source/Lib/Common/FileSystems/Models/IRelativePath.cs
index b8028d988..1c817d589 100644
--- a/Source/Lib/Common/FileSystems/Models/IRelativePath.cs
+++ b/Source/Lib/Common/FileSystems/Models/IRelativePath.cs
@@ -15,4 +15,21 @@ public interface IRelativePath : IPath
/// Given "../../../Homework/math.txt". The count is 3.
///
public int UpDirDirectiveCount { get; }
+
+ ///
+ /// One might prefer instead
+ /// of this method.
+ ///
+ /// This version adds an extra function invocation for no reason. To use
+ /// may be a negligible
+ /// optimization however.
+ ///
+ /// Keep this method here, it provides more clear documentation on how to create an instance
+ /// of . Having to invoke a method on the
+ /// is a bit hard to find.
+ ///
+ public static IRelativePath Factory(string path, bool isDirectory, IEnvironmentProvider environmentProvider)
+ {
+ return environmentProvider.RelativePathFactory(path, isDirectory);
+ }
}
\ No newline at end of file
diff --git a/Source/Tests/Ide/Basis/IdeTestBase.cs b/Source/Tests/Ide/Basis/IdeTestBase.cs
new file mode 100644
index 000000000..62882e2fb
--- /dev/null
+++ b/Source/Tests/Ide/Basis/IdeTestBase.cs
@@ -0,0 +1,122 @@
+using Fluxor;
+using Luthetus.Common.RazorLib.BackgroundTasks.Models;
+using Luthetus.Common.RazorLib.Installations.Models;
+using Luthetus.Common.RazorLib.Misc;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.JSInterop;
+using Luthetus.Ide.RazorLib.Installations.Models;
+using Luthetus.TextEditor.RazorLib.Installations.Models;
+using Luthetus.Common.RazorLib.FileSystems.Models;
+using Luthetus.Common.RazorLib.Exceptions;
+
+namespace Luthetus.Ide.Tests.Basis;
+
+public class IdeTestBase
+{
+ protected static void Test_RegisterServices(out ServiceProvider serviceProvider)
+ {
+ var backgroundTaskService = new BackgroundTaskServiceSynchronous();
+
+ var serviceCollection = new ServiceCollection()
+ .AddScoped()
+ .AddLuthetusIdeRazorLibServices(new LuthetusHostingInformation(LuthetusHostingKind.UnitTesting, backgroundTaskService))
+ .AddFluxor(options => options.ScanAssemblies(
+ typeof(LuthetusCommonConfig).Assembly,
+ typeof(LuthetusTextEditorConfig).Assembly,
+ typeof(LuthetusIdeConfig).Assembly));
+
+ serviceProvider = serviceCollection.BuildServiceProvider();
+
+ var store = serviceProvider.GetRequiredService();
+ store.InitializeAsync().Wait();
+
+ var environmentProvider = serviceProvider.GetRequiredService();
+ var fileSystemProvider = serviceProvider.GetRequiredService();
+
+ if (environmentProvider.GetType() != typeof(InMemoryEnvironmentProvider))
+ {
+ throw new LuthetusCommonException($"When unit testing one must use the {nameof(InMemoryEnvironmentProvider)} " +
+ $"implementation of {nameof(IEnvironmentProvider)}. This will avoid any side effects from running the tests.");
+ }
+
+ if (fileSystemProvider.GetType() != typeof(InMemoryFileSystemProvider))
+ {
+ throw new LuthetusCommonException($"When unit testing one must use the {nameof(InMemoryFileSystemProvider)} " +
+ $"implementation of {nameof(IFileSystemProvider)} This will avoid any side effects from running the tests.");
+ }
+ }
+
+ ///
+ /// The files shown in the 'tree' below will be written to the in-memory filesystem.
+ /// ---------------------------------------------
+ /// Root
+ /// ∙└───Homework
+ /// ∙∙∙∙∙∙├───Math
+ /// ∙∙∙∙∙∙│∙∙∙∙├───addition.txt
+ /// ∙∙∙∙∙∙│∙∙∙∙└───subtraction.txt
+ /// ∙∙∙∙∙∙│
+ /// ∙∙∙∙∙∙└───Biology
+ /// ∙∙∙∙∙∙∙∙∙∙∙├───nervousSystem.txt
+ /// ∙∙∙∙∙∙∙∙∙∙∙└───skeletalSystem.txt
+ ///
+ protected static void Test_CreateFileSystem(IServiceProvider serviceProvider)
+ {
+ // Cast as the in-memory provider to ensure the actual filesystem will not be used.
+ InMemoryEnvironmentProvider environmentProvider =
+ (InMemoryEnvironmentProvider)serviceProvider.GetRequiredService();
+
+ // Cast as the in-memory provider to ensure the actual filesystem will not be used.
+ InMemoryFileSystemProvider fileSystemProvider =
+ (InMemoryFileSystemProvider)serviceProvider.GetRequiredService();
+
+ WriteToInMemoryFileSystem(
+ environmentProvider,
+ fileSystemProvider);
+ }
+
+ private static void WriteToInMemoryFileSystem(
+ InMemoryEnvironmentProvider inMemoryEnvironmentProvider,
+ InMemoryFileSystemProvider inMemoryFileSystemProvider)
+ {
+ var dsc = inMemoryEnvironmentProvider.DirectorySeparatorChar;
+
+ inMemoryFileSystemProvider.File.WriteAllTextAsync(
+ $"{dsc}Homework{dsc}Math{dsc}addition.txt",
+ "3 + 7 = 10");
+
+ inMemoryFileSystemProvider.File.WriteAllTextAsync(
+ $"{dsc}Homework{dsc}Math{dsc}subtraction.txt",
+ "10 - 3 = 7");
+
+ inMemoryFileSystemProvider.File.WriteAllTextAsync(
+ $"{dsc}Homework{dsc}Biology{dsc}nervousSystem.txt",
+ "The nervous system is...");
+
+ inMemoryFileSystemProvider.File.WriteAllTextAsync(
+ $"{dsc}Homework{dsc}Biology{dsc}skeletalSystem.txt",
+ "The skeletal system is...");
+ }
+
+ protected class Test_WellKnownPaths
+ {
+ public class Directories
+ {
+ public const string Root = "/";
+ public const string Homework = "/Homework/";
+ public const string Math = "/Homework/Math/";
+ public const string Biology = "/Homework/Biology/";
+
+ public const string NonExistingDirectory = "/Homework/Hamburger/";
+ }
+
+ public class Files
+ {
+ public const string AdditionTxt = "/Homework/Math/addition.txt";
+ public const string SubtractionTxt = "/Homework/Math/subtraction.txt";
+ public const string NervousSystemTxt = "/Homework/Biology/nervousSystem.txt";
+ public const string SkeletalSystemTxt = "/Homework/Biology/skeletalSystem.txt";
+
+ public const string NonExistingFile = "/Homework/Hamburger/recipe.txt";
+ }
+ }
+}
diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewAbsolutePathTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewAbsolutePathTests.cs
index 0fa628bea..6024e1374 100644
--- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewAbsolutePathTests.cs
+++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewAbsolutePathTests.cs
@@ -3,13 +3,14 @@
using Luthetus.Common.RazorLib.TreeViews.Models;
using Luthetus.Ide.RazorLib.TreeViewImplementations.Models;
using Luthetus.Ide.RazorLib.ComponentRenderers.Models;
+using Microsoft.Extensions.DependencyInjection;
namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models;
///
///
///
-public class TreeViewAbsolutePathTests
+public class TreeViewAbsolutePathTests : IdeTestBase
{
///
///
@@ -22,7 +23,35 @@ public class TreeViewAbsolutePathTests
[Fact]
public void Constructor()
{
- throw new NotImplementedException();
+ Test_RegisterServices(out var serviceProvider);
+ Test_CreateFileSystem(serviceProvider);
+
+ var ideComponentRenderers = serviceProvider.GetRequiredService();
+ var commonComponentRenderers = serviceProvider.GetRequiredService();
+ var fileSystemProvider = serviceProvider.GetRequiredService();
+ var environmentProvider = serviceProvider.GetRequiredService();
+
+ var absolutePath = environmentProvider.AbsolutePathFactory(Test_WellKnownPaths.Files.NervousSystemTxt, false);
+
+ var isExpandable = true;
+ var isExpanded = true;
+
+ var treeView = new TreeViewAbsolutePath(
+ absolutePath,
+ ideComponentRenderers,
+ commonComponentRenderers,
+ fileSystemProvider,
+ environmentProvider,
+ isExpandable,
+ isExpanded);
+
+ Assert.Equal(treeView.Item, absolutePath);
+ Assert.Equal(treeView.IdeComponentRenderers, ideComponentRenderers);
+ Assert.Equal(treeView.CommonComponentRenderers, commonComponentRenderers);
+ Assert.Equal(treeView.FileSystemProvider, fileSystemProvider);
+ Assert.Equal(treeView.EnvironmentProvider, environmentProvider);
+ Assert.Equal(treeView.IsExpandable, isExpandable);
+ Assert.Equal(treeView.IsExpanded, isExpanded);
}
///
diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectDependenciesTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectDependenciesTests.cs
index 8b668517f..ffba0d340 100644
--- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectDependenciesTests.cs
+++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectDependenciesTests.cs
@@ -3,13 +3,16 @@
using Luthetus.CompilerServices.Lang.DotNetSolution.Models.Project;
using Luthetus.Ide.RazorLib.TreeViewImplementations.Models;
using Luthetus.Ide.RazorLib.ComponentRenderers.Models;
+using Luthetus.Common.RazorLib.ComponentRenderers.Models;
+using Luthetus.Common.RazorLib.Namespaces.Models;
+using Microsoft.Extensions.DependencyInjection;
namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models;
///
///
///
-public class TreeViewCSharpProjectDependenciesTests
+public class TreeViewCSharpProjectDependenciesTests : IdeTestBase
{
///
///
@@ -21,7 +24,36 @@ public class TreeViewCSharpProjectDependenciesTests
[Fact]
public void Constructor()
{
- throw new NotImplementedException();
+ Test_RegisterServices(out var serviceProvider);
+ Test_CreateFileSystem(serviceProvider);
+
+ var ideComponentRenderers = serviceProvider.GetRequiredService();
+ var commonComponentRenderers = serviceProvider.GetRequiredService();
+ var fileSystemProvider = serviceProvider.GetRequiredService();
+ var environmentProvider = serviceProvider.GetRequiredService();
+
+ var cSharpProjectDependencies = new CSharpProjectDependencies(
+ new NamespacePath(
+ "ProjectOne",
+ environmentProvider.AbsolutePathFactory("/ProjectOne/ProjectOne.csproj", false)));
+
+ var isExpandable = true;
+ var isExpanded = true;
+
+ var treeView = new TreeViewCSharpProjectDependencies(
+ cSharpProjectDependencies,
+ ideComponentRenderers,
+ fileSystemProvider,
+ environmentProvider,
+ isExpandable,
+ isExpanded);
+
+ Assert.Equal(treeView.Item, cSharpProjectDependencies);
+ Assert.Equal(treeView.IdeComponentRenderers, ideComponentRenderers);
+ Assert.Equal(treeView.FileSystemProvider, fileSystemProvider);
+ Assert.Equal(treeView.EnvironmentProvider, environmentProvider);
+ Assert.Equal(treeView.IsExpandable, isExpandable);
+ Assert.Equal(treeView.IsExpanded, isExpanded);
}
///
diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectNugetPackageReferenceTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectNugetPackageReferenceTests.cs
index f83ec0758..eac1e8958 100644
--- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectNugetPackageReferenceTests.cs
+++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectNugetPackageReferenceTests.cs
@@ -3,13 +3,17 @@
using Luthetus.Ide.RazorLib.TreeViewImplementations.Models;
using Luthetus.Ide.RazorLib.Nugets.Models;
using Luthetus.Ide.RazorLib.ComponentRenderers.Models;
+using Luthetus.Common.RazorLib.ComponentRenderers.Models;
+using Luthetus.Common.RazorLib.Namespaces.Models;
+using Luthetus.CompilerServices.Lang.DotNetSolution.Models.Project;
+using Microsoft.Extensions.DependencyInjection;
namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models;
///
///
///
-public class TreeViewCSharpProjectNugetPackageReferenceTests
+public class TreeViewCSharpProjectNugetPackageReferenceTests : IdeTestBase
{
///
///
@@ -21,7 +25,35 @@ public class TreeViewCSharpProjectNugetPackageReferenceTests
[Fact]
public void Constructor()
{
- throw new NotImplementedException();
+ Test_RegisterServices(out var serviceProvider);
+ Test_CreateFileSystem(serviceProvider);
+
+ var ideComponentRenderers = serviceProvider.GetRequiredService();
+ var commonComponentRenderers = serviceProvider.GetRequiredService();
+ var fileSystemProvider = serviceProvider.GetRequiredService();
+ var environmentProvider = serviceProvider.GetRequiredService();
+
+ var cSharpProjectNugetPackageReference = new CSharpProjectNugetPackageReference(
+ "/ProjectOne/ProjectOne.csproj",
+ new LightWeightNugetPackageRecord(string.Empty, string.Empty, string.Empty));
+
+ var isExpandable = true;
+ var isExpanded = true;
+
+ var treeView = new TreeViewCSharpProjectNugetPackageReference(
+ cSharpProjectNugetPackageReference,
+ ideComponentRenderers,
+ fileSystemProvider,
+ environmentProvider,
+ isExpandable,
+ isExpanded);
+
+ Assert.Equal(treeView.Item, cSharpProjectNugetPackageReference);
+ Assert.Equal(treeView.IdeComponentRenderers, ideComponentRenderers);
+ Assert.Equal(treeView.FileSystemProvider, fileSystemProvider);
+ Assert.Equal(treeView.EnvironmentProvider, environmentProvider);
+ Assert.Equal(treeView.IsExpandable, isExpandable);
+ Assert.Equal(treeView.IsExpanded, isExpanded);
}
///
diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectNugetPackageReferencesTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectNugetPackageReferencesTests.cs
index d5ca151d4..f0d02c7b9 100644
--- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectNugetPackageReferencesTests.cs
+++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectNugetPackageReferencesTests.cs
@@ -3,13 +3,16 @@
using Luthetus.CompilerServices.Lang.DotNetSolution.Models.Project;
using Luthetus.Ide.RazorLib.TreeViewImplementations.Models;
using Luthetus.Ide.RazorLib.ComponentRenderers.Models;
+using Microsoft.Extensions.DependencyInjection;
+using Luthetus.Common.RazorLib.Namespaces.Models;
+using Luthetus.Common.RazorLib.ComponentRenderers.Models;
namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models;
///
///
///
-public class TreeViewCSharpProjectNugetPackageReferencesTests
+public class TreeViewCSharpProjectNugetPackageReferencesTests : IdeTestBase
{
///
///
@@ -21,7 +24,36 @@ public class TreeViewCSharpProjectNugetPackageReferencesTests
[Fact]
public void Constructor()
{
- throw new NotImplementedException();
+ Test_RegisterServices(out var serviceProvider);
+ Test_CreateFileSystem(serviceProvider);
+
+ var ideComponentRenderers = serviceProvider.GetRequiredService();
+ var commonComponentRenderers = serviceProvider.GetRequiredService();
+ var fileSystemProvider = serviceProvider.GetRequiredService();
+ var environmentProvider = serviceProvider.GetRequiredService();
+
+ var cSharpProjectNugetPackageReferences = new CSharpProjectNugetPackageReferences(
+ new NamespacePath(
+ "ProjectOne",
+ environmentProvider.AbsolutePathFactory("/ProjectOne/ProjectOne.csproj", false)));
+
+ var isExpandable = true;
+ var isExpanded = true;
+
+ var treeView = new TreeViewCSharpProjectNugetPackageReferences(
+ cSharpProjectNugetPackageReferences,
+ ideComponentRenderers,
+ fileSystemProvider,
+ environmentProvider,
+ isExpandable,
+ isExpanded);
+
+ Assert.Equal(treeView.Item, cSharpProjectNugetPackageReferences);
+ Assert.Equal(treeView.IdeComponentRenderers, ideComponentRenderers);
+ Assert.Equal(treeView.FileSystemProvider, fileSystemProvider);
+ Assert.Equal(treeView.EnvironmentProvider, environmentProvider);
+ Assert.Equal(treeView.IsExpandable, isExpandable);
+ Assert.Equal(treeView.IsExpanded, isExpanded);
}
///
diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectToProjectReferenceTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectToProjectReferenceTests.cs
index 7d7a4b3e3..a4bb662ad 100644
--- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectToProjectReferenceTests.cs
+++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectToProjectReferenceTests.cs
@@ -3,13 +3,17 @@
using Luthetus.CompilerServices.Lang.DotNetSolution.Models.Project;
using Luthetus.Ide.RazorLib.TreeViewImplementations.Models;
using Luthetus.Ide.RazorLib.ComponentRenderers.Models;
+using Luthetus.Common.RazorLib.ComponentRenderers.Models;
+using Luthetus.Ide.RazorLib.Gits.Models;
+using Microsoft.Extensions.DependencyInjection;
+using Luthetus.Common.RazorLib.Namespaces.Models;
namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models;
///
///
///
-public class TreeViewCSharpProjectToProjectReferenceTests
+public class TreeViewCSharpProjectToProjectReferenceTests : IdeTestBase
{
///
///
@@ -21,7 +25,37 @@ public class TreeViewCSharpProjectToProjectReferenceTests
[Fact]
public void Constructor()
{
- throw new NotImplementedException();
+ Test_RegisterServices(out var serviceProvider);
+ Test_CreateFileSystem(serviceProvider);
+
+ var ideComponentRenderers = serviceProvider.GetRequiredService();
+ var commonComponentRenderers = serviceProvider.GetRequiredService();
+ var fileSystemProvider = serviceProvider.GetRequiredService();
+ var environmentProvider = serviceProvider.GetRequiredService();
+
+ var cSharpProjectToProjectReference = new CSharpProjectToProjectReference(
+ new NamespacePath(
+ "ProjectOne",
+ environmentProvider.AbsolutePathFactory("/ProjectOne/ProjectOne.csproj", false)),
+ environmentProvider.AbsolutePathFactory("/ProjectTwo/ProjectTwo.csproj", false));
+
+ var isExpandable = true;
+ var isExpanded = true;
+
+ var treeView = new TreeViewCSharpProjectToProjectReference(
+ cSharpProjectToProjectReference,
+ ideComponentRenderers,
+ fileSystemProvider,
+ environmentProvider,
+ isExpandable,
+ isExpanded);
+
+ Assert.Equal(treeView.Item, cSharpProjectToProjectReference);
+ Assert.Equal(treeView.IdeComponentRenderers, ideComponentRenderers);
+ Assert.Equal(treeView.FileSystemProvider, fileSystemProvider);
+ Assert.Equal(treeView.EnvironmentProvider, environmentProvider);
+ Assert.Equal(treeView.IsExpandable, isExpandable);
+ Assert.Equal(treeView.IsExpanded, isExpanded);
}
///
diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectToProjectReferencesTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectToProjectReferencesTests.cs
index 393d0e292..2cde15e44 100644
--- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectToProjectReferencesTests.cs
+++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCSharpProjectToProjectReferencesTests.cs
@@ -3,13 +3,16 @@
using Luthetus.CompilerServices.Lang.DotNetSolution.Models.Project;
using Luthetus.Ide.RazorLib.TreeViewImplementations.Models;
using Luthetus.Ide.RazorLib.ComponentRenderers.Models;
+using Luthetus.Common.RazorLib.ComponentRenderers.Models;
+using Luthetus.Common.RazorLib.Namespaces.Models;
+using Microsoft.Extensions.DependencyInjection;
namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models;
///
///
///
-public class TreeViewCSharpProjectToProjectReferencesTests
+public class TreeViewCSharpProjectToProjectReferencesTests : IdeTestBase
{
///
///
@@ -21,7 +24,36 @@ public class TreeViewCSharpProjectToProjectReferencesTests
[Fact]
public void Constructor()
{
- throw new NotImplementedException();
+ Test_RegisterServices(out var serviceProvider);
+ Test_CreateFileSystem(serviceProvider);
+
+ var ideComponentRenderers = serviceProvider.GetRequiredService();
+ var commonComponentRenderers = serviceProvider.GetRequiredService();
+ var fileSystemProvider = serviceProvider.GetRequiredService();
+ var environmentProvider = serviceProvider.GetRequiredService();
+
+ var cSharpProjectToProjectReferences = new CSharpProjectToProjectReferences(
+ new NamespacePath(
+ "ProjectOne",
+ environmentProvider.AbsolutePathFactory("/ProjectOne/ProjectOne.csproj", false)));
+
+ var isExpandable = true;
+ var isExpanded = true;
+
+ var treeView = new TreeViewCSharpProjectToProjectReferences(
+ cSharpProjectToProjectReferences,
+ ideComponentRenderers,
+ fileSystemProvider,
+ environmentProvider,
+ isExpandable,
+ isExpanded);
+
+ Assert.Equal(treeView.Item, cSharpProjectToProjectReferences);
+ Assert.Equal(treeView.IdeComponentRenderers, ideComponentRenderers);
+ Assert.Equal(treeView.FileSystemProvider, fileSystemProvider);
+ Assert.Equal(treeView.EnvironmentProvider, environmentProvider);
+ Assert.Equal(treeView.IsExpandable, isExpandable);
+ Assert.Equal(treeView.IsExpanded, isExpanded);
}
///
diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCompilerServiceTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCompilerServiceTests.cs
index 5a0eaf05a..0bf0731f4 100644
--- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCompilerServiceTests.cs
+++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewCompilerServiceTests.cs
@@ -2,13 +2,19 @@
using Luthetus.TextEditor.RazorLib.CompilerServices.Interfaces;
using Luthetus.Ide.RazorLib.ComponentRenderers.Models;
using Luthetus.Ide.RazorLib.TreeViewImplementations.Models;
+using Luthetus.Common.RazorLib.FileSystems.Models;
+using Luthetus.Common.RazorLib.Namespaces.Models;
+using Luthetus.CompilerServices.Lang.DotNetSolution.Models.Project;
+using Microsoft.Extensions.DependencyInjection;
+using Luthetus.CompilerServices.Lang.CSharp.CompilerServiceCase;
+using Luthetus.TextEditor.RazorLib;
namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models;
///
///
///
-public class TreeViewCompilerServiceTests
+public class TreeViewCompilerServiceTests : IdeTestBase
{
///
///
@@ -19,7 +25,32 @@ public class TreeViewCompilerServiceTests
[Fact]
public void Constructor()
{
- throw new NotImplementedException();
+ Test_RegisterServices(out var serviceProvider);
+ Test_CreateFileSystem(serviceProvider);
+
+ var ideComponentRenderers = serviceProvider.GetRequiredService();
+ var commonComponentRenderers = serviceProvider.GetRequiredService();
+ var fileSystemProvider = serviceProvider.GetRequiredService();
+ var environmentProvider = serviceProvider.GetRequiredService();
+
+ var compilerService = new CSharpCompilerService(
+ serviceProvider.GetRequiredService());
+
+ var isExpandable = true;
+ var isExpanded = true;
+
+ var treeView = new TreeViewCompilerService(
+ compilerService,
+ ideComponentRenderers,
+ commonComponentRenderers,
+ isExpandable,
+ isExpanded);
+
+ Assert.Equal(treeView.Item, compilerService);
+ Assert.Equal(treeView.IdeComponentRenderers, ideComponentRenderers);
+ Assert.Equal(treeView.CommonComponentRenderers, commonComponentRenderers);
+ Assert.Equal(treeView.IsExpandable, isExpandable);
+ Assert.Equal(treeView.IsExpanded, isExpanded);
}
///
diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewGitFileTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewGitFileTests.cs
index f54da1cce..a0a20041f 100644
--- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewGitFileTests.cs
+++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewGitFileTests.cs
@@ -2,13 +2,17 @@
using Luthetus.Ide.RazorLib.TreeViewImplementations.Models;
using Luthetus.Ide.RazorLib.ComponentRenderers.Models;
using Luthetus.Ide.RazorLib.Gits.Models;
+using Luthetus.Common.RazorLib.ComponentRenderers.Models;
+using Luthetus.Common.RazorLib.FileSystems.Models;
+using Microsoft.AspNetCore.Components;
+using Microsoft.Extensions.DependencyInjection;
namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models;
///
///
///
-public class TreeViewGitFileTests
+public class TreeViewGitFileTests : IdeTestBase
{
///
///
@@ -18,7 +22,31 @@ public class TreeViewGitFileTests
[Fact]
public void Constructor()
{
- throw new NotImplementedException();
+ Test_RegisterServices(out var serviceProvider);
+ Test_CreateFileSystem(serviceProvider);
+
+ var ideComponentRenderers = serviceProvider.GetRequiredService();
+ var commonComponentRenderers = serviceProvider.GetRequiredService();
+ var fileSystemProvider = serviceProvider.GetRequiredService();
+ var environmentProvider = serviceProvider.GetRequiredService();
+
+ var gitFile = new GitFile(
+ environmentProvider.AbsolutePathFactory("/unitTesting.txt", false),
+ GitDirtyReason.Untracked);
+
+ var isExpandable = true;
+ var isExpanded = true;
+
+ var treeView = new TreeViewGitFile(
+ gitFile,
+ ideComponentRenderers,
+ isExpandable,
+ isExpanded);
+
+ Assert.Equal(treeView.Item, gitFile);
+ Assert.Equal(treeView.IdeComponentRenderers, ideComponentRenderers);
+ Assert.Equal(treeView.IsExpandable, isExpandable);
+ Assert.Equal(treeView.IsExpanded, isExpanded);
}
///
diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewMarkupStringTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewMarkupStringTests.cs
index a8568f2b2..63957c9c5 100644
--- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewMarkupStringTests.cs
+++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewMarkupStringTests.cs
@@ -3,13 +3,16 @@
using Luthetus.Common.RazorLib.TreeViews.Models;
using Luthetus.Ide.RazorLib.ComponentRenderers.Models;
using Luthetus.Ide.RazorLib.TreeViewImplementations.Models;
+using Luthetus.Common.RazorLib.ComponentRenderers.Models;
+using Luthetus.Common.RazorLib.Namespaces.Models;
+using Microsoft.Extensions.DependencyInjection;
namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models;
///
///
///
-public class TreeViewMarkupStringTests
+public class TreeViewMarkupStringTests : IdeTestBase
{
///
///
@@ -21,7 +24,33 @@ public class TreeViewMarkupStringTests
[Fact]
public void Constructor()
{
- throw new NotImplementedException();
+ Test_RegisterServices(out var serviceProvider);
+ Test_CreateFileSystem(serviceProvider);
+
+ var ideComponentRenderers = serviceProvider.GetRequiredService();
+ var commonComponentRenderers = serviceProvider.GetRequiredService();
+ var fileSystemProvider = serviceProvider.GetRequiredService();
+ var environmentProvider = serviceProvider.GetRequiredService();
+
+ var markupString = new MarkupString("Abc123
");
+
+ var isExpandable = true;
+ var isExpanded = true;
+
+ var treeView = new TreeViewMarkupString(
+ markupString,
+ ideComponentRenderers,
+ fileSystemProvider,
+ environmentProvider,
+ isExpandable,
+ isExpanded);
+
+ Assert.Equal(treeView.Item, markupString);
+ Assert.Equal(treeView.IdeComponentRenderers, ideComponentRenderers);
+ Assert.Equal(treeView.FileSystemProvider, fileSystemProvider);
+ Assert.Equal(treeView.EnvironmentProvider, environmentProvider);
+ Assert.Equal(treeView.IsExpandable, isExpandable);
+ Assert.Equal(treeView.IsExpanded, isExpanded);
}
///
diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewNamespacePathTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewNamespacePathTests.cs
index f2f4c104c..d79b0d781 100644
--- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewNamespacePathTests.cs
+++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewNamespacePathTests.cs
@@ -4,13 +4,15 @@
using Luthetus.Common.RazorLib.FileSystems.Models;
using Luthetus.Ide.RazorLib.TreeViewImplementations.Models;
using Luthetus.Ide.RazorLib.ComponentRenderers.Models;
+using Luthetus.Ide.RazorLib.TestExplorers.Models;
+using Microsoft.Extensions.DependencyInjection;
namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models;
///
///
///
-public class TreeViewNamespacePathTests
+public class TreeViewNamespacePathTests : IdeTestBase
{
///
///
@@ -23,7 +25,37 @@ public class TreeViewNamespacePathTests
[Fact]
public void Constructor()
{
- throw new NotImplementedException();
+ Test_RegisterServices(out var serviceProvider);
+ Test_CreateFileSystem(serviceProvider);
+
+ var ideComponentRenderers = serviceProvider.GetRequiredService();
+ var commonComponentRenderers = serviceProvider.GetRequiredService();
+ var fileSystemProvider = serviceProvider.GetRequiredService();
+ var environmentProvider = serviceProvider.GetRequiredService();
+
+ var namespacePath = new NamespacePath(
+ "MyNamespace",
+ environmentProvider.AbsolutePathFactory("/unitTesting.cs", false));
+
+ var isExpandable = true;
+ var isExpanded = true;
+
+ var treeView = new TreeViewNamespacePath(
+ namespacePath,
+ ideComponentRenderers,
+ commonComponentRenderers,
+ fileSystemProvider,
+ environmentProvider,
+ isExpandable,
+ isExpanded);
+
+ Assert.Equal(treeView.Item, namespacePath);
+ Assert.Equal(treeView.IdeComponentRenderers, ideComponentRenderers);
+ Assert.Equal(treeView.CommonComponentRenderers, commonComponentRenderers);
+ Assert.Equal(treeView.FileSystemProvider, fileSystemProvider);
+ Assert.Equal(treeView.EnvironmentProvider, environmentProvider);
+ Assert.Equal(treeView.IsExpandable, isExpandable);
+ Assert.Equal(treeView.IsExpanded, isExpanded);
}
///
diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewProjectTestModelTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewProjectTestModelTests.cs
index 21be55c69..a10814985 100644
--- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewProjectTestModelTests.cs
+++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewProjectTestModelTests.cs
@@ -2,13 +2,17 @@
using Luthetus.Common.RazorLib.TreeViews.Models;
using Luthetus.Ide.RazorLib.TreeViewImplementations.Models;
using Luthetus.Ide.RazorLib.TestExplorers.Models;
+using Luthetus.Common.RazorLib.FileSystems.Models;
+using Luthetus.Common.RazorLib.WatchWindows.Models;
+using Luthetus.Ide.RazorLib.ComponentRenderers.Models;
+using Microsoft.Extensions.DependencyInjection;
namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models;
///
///
///
-public class TreeViewProjectTestModelTests
+public class TreeViewProjectTestModelTests : IdeTestBase
{
///
///
@@ -18,7 +22,33 @@ public class TreeViewProjectTestModelTests
[Fact]
public void Constructor()
{
- throw new NotImplementedException();
+ Test_RegisterServices(out var serviceProvider);
+ Test_CreateFileSystem(serviceProvider);
+
+ var ideComponentRenderers = serviceProvider.GetRequiredService();
+ var commonComponentRenderers = serviceProvider.GetRequiredService();
+ var fileSystemProvider = serviceProvider.GetRequiredService();
+ var environmentProvider = serviceProvider.GetRequiredService();
+
+ var projectTestModel = new ProjectTestModel(
+ Guid.NewGuid(),
+ environmentProvider.AbsolutePathFactory("/unitTesting.txt", false),
+ callback => Task.CompletedTask,
+ callback => { });
+
+ var isExpandable = true;
+ var isExpanded = true;
+
+ var treeView = new TreeViewProjectTestModel(
+ projectTestModel,
+ commonComponentRenderers,
+ isExpandable,
+ isExpanded);
+
+ Assert.Equal(treeView.Item, projectTestModel);
+ Assert.Equal(treeView.IsExpandable, isExpandable);
+ Assert.Equal(treeView.IsExpanded, isExpanded);
+ Assert.Equal(treeView.CommonComponentRenderers, commonComponentRenderers);
}
///
diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewReflectionWithViewTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewReflectionWithViewTests.cs
index b13f879fd..7ed6df5bc 100644
--- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewReflectionWithViewTests.cs
+++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewReflectionWithViewTests.cs
@@ -2,13 +2,18 @@
using Luthetus.Common.RazorLib.WatchWindows.Models;
using Luthetus.Ide.RazorLib.TreeViewImplementations.Models;
using Luthetus.Ide.RazorLib.ComponentRenderers.Models;
+using Luthetus.Common.RazorLib.FileSystems.Models;
+using Luthetus.CompilerServices.Lang.DotNetSolution.Models.Project;
+using Luthetus.TextEditor.RazorLib.CompilerServices.Syntax.Tokens;
+using Luthetus.TextEditor.RazorLib.Lexes.Models;
+using Microsoft.Extensions.DependencyInjection;
namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models;
///
///
///
-public class TreeViewReflectionWithViewTests
+public class TreeViewReflectionWithViewTests : IdeTestBase
{
///
///
@@ -19,7 +24,32 @@ public class TreeViewReflectionWithViewTests
[Fact]
public void Constructor()
{
- throw new NotImplementedException();
+ Test_RegisterServices(out var serviceProvider);
+ Test_CreateFileSystem(serviceProvider);
+
+ var ideComponentRenderers = serviceProvider.GetRequiredService();
+ var commonComponentRenderers = serviceProvider.GetRequiredService();
+ var fileSystemProvider = serviceProvider.GetRequiredService();
+ var environmentProvider = serviceProvider.GetRequiredService();
+
+ var item = "abc123";
+ var watchWindowObject = new WatchWindowObject(item, item.GetType(), nameof(item), false);
+
+ var isExpandable = true;
+ var isExpanded = true;
+
+ var treeView = new TreeViewReflectionWithView(
+ watchWindowObject,
+ isExpandable,
+ isExpanded,
+ ideComponentRenderers,
+ commonComponentRenderers);
+
+ Assert.Equal(treeView.Item, watchWindowObject);
+ Assert.Equal(treeView.IsExpandable, isExpandable);
+ Assert.Equal(treeView.IsExpanded, isExpanded);
+ Assert.Equal(treeView.IdeComponentRenderers, ideComponentRenderers);
+ Assert.Equal(treeView.CommonComponentRenderers, commonComponentRenderers);
}
///
diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSolutionFolderTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSolutionFolderTests.cs
index f899d98e2..ba3795b89 100644
--- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSolutionFolderTests.cs
+++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSolutionFolderTests.cs
@@ -4,13 +4,18 @@
using Luthetus.CompilerServices.Lang.DotNetSolution.Models.Project;
using Luthetus.Ide.RazorLib.TreeViewImplementations.Models;
using Luthetus.Ide.RazorLib.ComponentRenderers.Models;
+using Luthetus.CompilerServices.Lang.DotNetSolution.Models;
+using System.Collections.Immutable;
+using Microsoft.Extensions.DependencyInjection;
+using Luthetus.TextEditor.RazorLib.CompilerServices.Syntax.Tokens;
+using Luthetus.TextEditor.RazorLib.Lexes.Models;
namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models;
///
///
///
-public class TreeViewSolutionFolderTests
+public class TreeViewSolutionFolderTests : IdeTestBase
{
///
///
@@ -23,7 +28,42 @@ public class TreeViewSolutionFolderTests
[Fact]
public void Constructor()
{
- throw new NotImplementedException();
+ Test_RegisterServices(out var serviceProvider);
+ Test_CreateFileSystem(serviceProvider);
+
+ var ideComponentRenderers = serviceProvider.GetRequiredService();
+ var commonComponentRenderers = serviceProvider.GetRequiredService();
+ var fileSystemProvider = serviceProvider.GetRequiredService();
+ var environmentProvider = serviceProvider.GetRequiredService();
+
+ var dotNetSolutionFolder = new SolutionFolder(
+ "Tests",
+ Guid.NewGuid(),
+ string.Empty,
+ Guid.NewGuid(),
+ new OpenAssociatedGroupToken(TextEditorTextSpan.FabricateTextSpan(string.Empty)),
+ new CloseAssociatedGroupToken(TextEditorTextSpan.FabricateTextSpan(string.Empty)),
+ environmentProvider.AbsolutePathFactory(string.Empty, false));
+
+ var isExpandable = true;
+ var isExpanded = true;
+
+ var treeView = new TreeViewSolutionFolder(
+ dotNetSolutionFolder,
+ ideComponentRenderers,
+ commonComponentRenderers,
+ fileSystemProvider,
+ environmentProvider,
+ isExpandable,
+ isExpanded);
+
+ Assert.Equal(treeView.Item, dotNetSolutionFolder);
+ Assert.Equal(treeView.IdeComponentRenderers, ideComponentRenderers);
+ Assert.Equal(treeView.CommonComponentRenderers, commonComponentRenderers);
+ Assert.Equal(treeView.FileSystemProvider, fileSystemProvider);
+ Assert.Equal(treeView.EnvironmentProvider, environmentProvider);
+ Assert.Equal(treeView.IsExpandable, isExpandable);
+ Assert.Equal(treeView.IsExpanded, isExpanded);
}
///
diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSolutionTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSolutionTests.cs
index 7d6f07d94..11691acef 100644
--- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSolutionTests.cs
+++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSolutionTests.cs
@@ -4,13 +4,16 @@
using Luthetus.CompilerServices.Lang.DotNetSolution.Models;
using Luthetus.Ide.RazorLib.TreeViewImplementations.Models;
using Luthetus.Ide.RazorLib.ComponentRenderers.Models;
+using Microsoft.Extensions.DependencyInjection;
+using System.Collections.Immutable;
+using Luthetus.CompilerServices.Lang.DotNetSolution.Models.Project;
namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models;
///
///
///
-public class TreeViewSolutionTests
+public class TreeViewSolutionTests : IdeTestBase
{
///
///
@@ -23,7 +26,42 @@ public class TreeViewSolutionTests
[Fact]
public void Constructor()
{
- throw new NotImplementedException();
+ Test_RegisterServices(out var serviceProvider);
+ Test_CreateFileSystem(serviceProvider);
+
+ var ideComponentRenderers = serviceProvider.GetRequiredService();
+ var commonComponentRenderers = serviceProvider.GetRequiredService();
+ var fileSystemProvider = serviceProvider.GetRequiredService();
+ var environmentProvider = serviceProvider.GetRequiredService();
+
+ var dotNetSolutionModel = new DotNetSolutionModel(
+ environmentProvider.AbsolutePathFactory("/unitTesting.sln", false),
+ new DotNetSolutionHeader(),
+ ImmutableArray.Empty,
+ ImmutableArray.Empty,
+ ImmutableArray.Empty,
+ new DotNetSolutionGlobal(),
+ string.Empty);
+
+ var isExpandable = true;
+ var isExpanded = true;
+
+ var treeView = new TreeViewSolution(
+ dotNetSolutionModel,
+ ideComponentRenderers,
+ commonComponentRenderers,
+ fileSystemProvider,
+ environmentProvider,
+ isExpandable,
+ isExpanded);
+
+ Assert.Equal(treeView.Item, dotNetSolutionModel);
+ Assert.Equal(treeView.IdeComponentRenderers, ideComponentRenderers);
+ Assert.Equal(treeView.CommonComponentRenderers, commonComponentRenderers);
+ Assert.Equal(treeView.FileSystemProvider, fileSystemProvider);
+ Assert.Equal(treeView.EnvironmentProvider, environmentProvider);
+ Assert.Equal(treeView.IsExpandable, isExpandable);
+ Assert.Equal(treeView.IsExpanded, isExpanded);
}
///
diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSpinnerTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSpinnerTests.cs
index c2c720a78..aa9aca437 100644
--- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSpinnerTests.cs
+++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewSpinnerTests.cs
@@ -1,13 +1,17 @@
using Luthetus.Common.RazorLib.ComponentRenderers.Models;
+using Luthetus.Common.RazorLib.FileSystems.Models;
using Luthetus.Common.RazorLib.TreeViews.Models;
+using Luthetus.Ide.RazorLib.ComponentRenderers.Models;
+using Luthetus.Ide.RazorLib.TestExplorers.Models;
using Luthetus.Ide.RazorLib.TreeViewImplementations.Models;
+using Microsoft.Extensions.DependencyInjection;
namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models;
///
///
///
-public class TreeViewSpinnerTests
+public class TreeViewSpinnerTests : IdeTestBase
{
///
///
@@ -17,7 +21,29 @@ public class TreeViewSpinnerTests
[Fact]
public void Constructor()
{
- throw new NotImplementedException();
+ Test_RegisterServices(out var serviceProvider);
+ Test_CreateFileSystem(serviceProvider);
+
+ var ideComponentRenderers = serviceProvider.GetRequiredService();
+ var commonComponentRenderers = serviceProvider.GetRequiredService();
+ var fileSystemProvider = serviceProvider.GetRequiredService();
+ var environmentProvider = serviceProvider.GetRequiredService();
+
+ var guid = Guid.NewGuid();
+
+ var isExpandable = true;
+ var isExpanded = true;
+
+ var treeView = new TreeViewSpinner(
+ guid,
+ commonComponentRenderers,
+ isExpandable,
+ isExpanded);
+
+ Assert.Equal(treeView.Item, guid);
+ Assert.Equal(treeView.CommonComponentRenderers, commonComponentRenderers);
+ Assert.Equal(treeView.IsExpandable, isExpandable);
+ Assert.Equal(treeView.IsExpanded, isExpanded);
}
///
diff --git a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewStringFragmentTests.cs b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewStringFragmentTests.cs
index c8de26bfa..08edffa56 100644
--- a/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewStringFragmentTests.cs
+++ b/Source/Tests/Ide/Basis/TreeViewImplementations/Models/TreeViewStringFragmentTests.cs
@@ -2,13 +2,16 @@
using Luthetus.Common.RazorLib.TreeViews.Models;
using Luthetus.Ide.RazorLib.TreeViewImplementations.Models;
using Luthetus.Ide.RazorLib.TestExplorers.Models;
+using Luthetus.Common.RazorLib.FileSystems.Models;
+using Luthetus.Ide.RazorLib.ComponentRenderers.Models;
+using Microsoft.Extensions.DependencyInjection;
namespace Luthetus.Ide.Tests.Basis.TreeViewImplementations.Models;
///
///
///
-public class TreeViewStringFragmentTests
+public class TreeViewStringFragmentTests : IdeTestBase
{
///
///
@@ -18,7 +21,29 @@ public class TreeViewStringFragmentTests
[Fact]
public void Constructor()
{
- throw new NotImplementedException();
+ Test_RegisterServices(out var serviceProvider);
+ Test_CreateFileSystem(serviceProvider);
+
+ var ideComponentRenderers = serviceProvider.GetRequiredService();
+ var commonComponentRenderers = serviceProvider.GetRequiredService();
+ var fileSystemProvider = serviceProvider.GetRequiredService();
+ var environmentProvider = serviceProvider.GetRequiredService();
+
+ var stringFragment = new StringFragment("abc.123");
+
+ var isExpandable = true;
+ var isExpanded = true;
+
+ var treeView = new TreeViewStringFragment(
+ stringFragment,
+ commonComponentRenderers,
+ isExpandable,
+ isExpanded);
+
+ Assert.Equal(treeView.Item, stringFragment);
+ Assert.Equal(treeView.CommonComponentRenderers, commonComponentRenderers);
+ Assert.Equal(treeView.IsExpandable, isExpandable);
+ Assert.Equal(treeView.IsExpanded, isExpanded);
}
///