diff --git a/.nuget/Cuemon.Core/PackageReleaseNotes.txt b/.nuget/Cuemon.Core/PackageReleaseNotes.txt
index 9cf7a4f38..31b091347 100644
--- a/.nuget/Cuemon.Core/PackageReleaseNotes.txt
+++ b/.nuget/Cuemon.Core/PackageReleaseNotes.txt
@@ -45,6 +45,21 @@ Availability: .NET 9, .NET 8 and .NET Standard 2.0
- REMOVED UnitPrefix enum from the Cuemon namespace
- REMOVED UnitPrefixFormatter class from the Cuemon namespace
- REMOVED ZeroPrefix class from the Cuemon namespace
+- REMOVED DataPairCollection class from the Cuemon.Collections namespace
+- REMOVED DataPairDictionary class from the Cuemon.Collections namespace
+- REMOVED Initializer class from the Cuemon namespace
+- REMOVED InitializerBuilder class from the Cuemon namespace
+- REMOVED Mapping class from the Cuemon namespace
+- REMOVED IndexMapping class from the Cuemon namespace
+- REMOVED HorizontalDirection enum from the Cuemon namespace
+- REMOVED VerticalDirection enum from the Cuemon namespace (moved to the Cuemon.Extensions namespace in the Cuemon.Extensions.Core assembly)
+- REMOVED IWrapper interface from the Cuemon namespace (moved to the Cuemon.Extensions namespace in the Cuemon.Extensions.Core assembly)
+- REMOVED Wrapper class from the Cuemon namespace (moved to the Cuemon.Extensions namespace in the Cuemon.Extensions.Core assembly)
+- REMOVED HierarchyDecoratorExtensions class from the Cuemon namespace (moved to the Cuemon.Extensions.Runtime namespace in the Cuemon.Extensions.Core assembly)
+- REMOVED Hierarchy class from the Cuemon namespace (moved to the Cuemon.Extensions.Runtime namespace in the Cuemon.Extensions.Core assembly)
+- REMOVED IHierarchy interface from the Cuemon namespace (moved to the Cuemon.Extensions.Runtime namespace in the Cuemon.Extensions.Core assembly)
+- REMOVED ObjectHierarchyOptions class from the Cuemon.Reflection namespace (moved to the Cuemon.Extensions.Runtime namespace in the Cuemon.Extensions.Core assembly and renamed to HierarchyOptions)
+- REMOVED HierarchySerializer class from the Cuemon.Runtime.Serialization namespace (moved to the Cuemon.Extensions.Runtime.Serialization namespace in the Cuemon.Extensions.Core assembly)
# New Features
- ADDED Failure record in the Cuemon.Diagnostics namespace that represents a failure model with detailed information about an exception
diff --git a/.nuget/Cuemon.Extensions.Core/PackageReleaseNotes.txt b/.nuget/Cuemon.Extensions.Core/PackageReleaseNotes.txt
index 6db089461..c293c891d 100644
--- a/.nuget/Cuemon.Extensions.Core/PackageReleaseNotes.txt
+++ b/.nuget/Cuemon.Extensions.Core/PackageReleaseNotes.txt
@@ -9,6 +9,7 @@ Availability: .NET 9, .NET 8 and .NET Standard 2.0
- REMOVED ConditionExtensions class from the Cuemon.Extensions namespace and moved members to Condition class in the Cuemon.Core assembly (Cuemon namespace)
- REMOVED ValidatorExtensions class from the Cuemon.Extensions namespace and moved members to Validator class in the Cuemon.Core assembly (Cuemon namespace)
- REMOVED ReplaceLineEndings extension method from the StringExtensions class in the Cuemon.Extensions namespace
+- REMOVED MappingExtensions class from the Cuemon.Extensions namespace
# New Features
- ADDED ActionFactory class in the Cuemon.Extensions namespace that provides access to factory methods for creating ActionFactory{TTuple} objects that encapsulate a delegate with a variable amount of generic arguments
@@ -16,6 +17,14 @@ Availability: .NET 9, .NET 8 and .NET Standard 2.0
- ADDED MutableTupleFactory class in the Cuemon.Extensions namespace that provides access to factory methods for creating MutableTuple objects
- ADDED TesterFuncFactory class in the Cuemon.Extensions namespace that provides access to factory methods for creating TesterFuncFactory{TTuple, TResult, TSuccess} objects that encapsulate a tester function delegate with a variable amount of generic arguments
- ADDED AsyncDisposable class in the Cuemon.Extensions namespace that provides a mechanism for asynchronously releasing both managed and unmanaged resources with focus on the former
+- ADDED VerticalDirection enum in the Cuemon.Extensions namespace that specifies a set of values defining a vertical direction
+- ADDED IWrapper interface in the Cuemon.Extensions namespace that defines a generic way to wrap an object instance inside another object
+- ADDED Wrapper class in the Cuemon.Extensions namespace that provides a way to wrap an object instance inside another object
+- ADDED Hierarchy class in the Cuemon.Extensions.Runtime namespace that represents a way to expose a node of a hierarchical structure, including the node object type
+- ADDED HierarchyDecoratorExtensions class in the Cuemon.Extensions.Runtime namespace that provides (hidden) extensions to the IHierarchy interface
+- ADDED HierarchyOptions class in the Cuemon.Extensions.Runtime namespace that represents a set of options to configure the behavior of the Hierarchy and HierarchySerializer class
+- ADDED IHierarchy interface in the Cuemon.Extensions.Runtime namespace that defines a way to expose a node of a hierarchical structure
+- ADDED HierarchySerializer class in the Cuemon.Extensions.Runtime.Serialization namespace that provides a way to serialize objects to nodes of IHierarchy
Version 8.3.2
Availability: .NET 8, .NET 6 and .NET Standard 2.0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eabb946a6..8e5f05b3d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
For more details, please refer to `PackageReleaseNotes.txt` on a per assembly basis in the `.nuget` folder.
-## [9.0.0] - TBD (sometime in November 2024)
+## [9.0.0] - 2024-11-13
> [!IMPORTANT]
> The following projects has been removed with this release and migrated to [Codebelt](https://github.com/codebeltnet):
@@ -21,6 +21,8 @@ For more details, please refer to `PackageReleaseNotes.txt` on a per assembly ba
> [!NOTE]
> Types that are removed from this solution (but otherwise fits naturally together) will be migrated to smaller and more focused repositories in the [Codebelt](https://github.com/codebeltnet) organization, renamed to better reflect their purpose and published as standalone packages on NuGet.
+>
+> - [Codebelt.Unitify](https://github.com/codebeltnet/unitify) is an example of a repository that received types from this solution and is now a standalone library that provides a uniform way of working with prefixes and multiples in the context of units of measure.
This major release is first and foremost focused on ironing out any wrinkles that have been introduced with .NET 9 preview releases so the final release is production ready together with the official launch from Microsoft.
@@ -32,6 +34,9 @@ Highlighted features included in this release:
- Support for both **FaultDetails** (HttpExceptionDescriptor) and **ProblemDetails** in the context of ASP.NET (both vanilla and MVC)
- Reduced footprint in the core assemblies by removing obsolete and redundant code
+ - Went from approximately 700 KB to 500 KB in the core assembly
+ - Types reduced with approximately 20% which is about 100 types
+- Central Package Management (CPM) for all projects in the solution
### Added
@@ -54,6 +59,14 @@ Highlighted features included in this release:
- MutableTupleFactory class in the Cuemon.Extensions namespace that provides access to factory methods for creating MutableTuple objects
- TesterFuncFactory class in the Cuemon.Extensions namespace that provides access to factory methods for creating TesterFuncFactory{TTuple, TResult, TSuccess} objects that encapsulate a tester function delegate with a variable amount of generic arguments
- AsyncDisposable class in the Cuemon.Extensions namespace that provides a mechanism for asynchronously releasing both managed and unmanaged resources with focus on the former
+- VerticalDirection enum in the Cuemon.Extensions namespace that specifies a set of values defining a vertical direction
+- IWrapper interface in the Cuemon.Extensions namespace that defines a generic way to wrap an object instance inside another object
+- Wrapper class in the Cuemon.Extensions namespace that provides a way to wrap an object instance inside another object
+- Hierarchy class in the Cuemon.Extensions.Runtime namespace that represents a way to expose a node of a hierarchical structure, including the node object type
+- HierarchyDecoratorExtensions class in the Cuemon.Extensions.Runtime namespace that provides (hidden) extensions to the IHierarchy interface
+- HierarchyOptions class in the Cuemon.Extensions.Runtime namespace that represents a set of options to configure the behavior of the Hierarchy and HierarchySerializer class
+- IHierarchy interface in the Cuemon.Extensions.Runtime namespace that defines a way to expose a node of a hierarchical structure
+- HierarchySerializer class in the Cuemon.Extensions.Runtime.Serialization namespace that provides a way to serialize objects to nodes of IHierarchy
### Changed
@@ -165,6 +178,21 @@ Highlighted features included in this release:
- UnitPrefix enum from the Cuemon namespace (breaking change)
- UnitPrefixFormatter class from the Cuemon namespace (breaking change)
- ZeroPrefix class from the Cuemon namespace (breaking change)
+- DataPairCollection class from the Cuemon.Collections namespace
+- DataPairDictionary class from the Cuemon.Collections namespace
+- Initializer class from the Cuemon namespace
+- InitializerBuilder class from the Cuemon namespace
+- Mapping class from the Cuemon namespace
+- IndexMapping class from the Cuemon namespace
+- HorizontalDirection enum from the Cuemon namespace
+- VerticalDirection enum from the Cuemon namespace (moved to the Cuemon.Extensions namespace in the Cuemon.Extensions.Core assembly)
+- IWrapper interface from the Cuemon namespace (moved to the Cuemon.Extensions namespace in the Cuemon.Extensions.Core assembly)
+- Wrapper class from the Cuemon namespace (moved to the Cuemon.Extensions namespace in the Cuemon.Extensions.Core assembly)
+- HierarchyDecoratorExtensions class from the Cuemon namespace (moved to the Cuemon.Extensions.Runtime namespace in the Cuemon.Extensions.Core assembly)
+- Hierarchy class from the Cuemon namespace (moved to the Cuemon.Extensions.Runtime namespace in the Cuemon.Extensions.Core assembly)
+- IHierarchy interface from the Cuemon namespace (moved to the Cuemon.Extensions.Runtime namespace in the Cuemon.Extensions.Core assembly)
+- ObjectHierarchyOptions class from the Cuemon.Reflection namespace (moved to the Cuemon.Extensions.Runtime namespace in the Cuemon.Extensions.Core assembly and renamed to HierarchyOptions)
+- HierarchySerializer class from the Cuemon.Runtime.Serialization namespace (moved to the Cuemon.Extensions.Runtime.Serialization namespace in the Cuemon.Extensions.Core assembly)
## [8.3.2] - 2024-08-04
diff --git a/src/Cuemon.Core/Collections/DataPairCollection.cs b/src/Cuemon.Core/Collections/DataPairCollection.cs
deleted file mode 100644
index a266ba63d..000000000
--- a/src/Cuemon.Core/Collections/DataPairCollection.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System;
-using System.Collections.ObjectModel;
-
-namespace Cuemon.Collections
-{
- ///
- /// Provides a collection of .
- ///
- public class DataPairCollection : Collection
- {
- ///
- /// Initializes a new instance of the class.
- ///
- public DataPairCollection() : base()
- {
- }
-
- ///
- /// Adds a new to the end of this .
- ///
- /// The type of the data being added to this instance.
- /// The name of the data pair.
- /// The value of the data pair.
- public void Add(string name, T value)
- {
- Add(name, value, typeof(T));
- }
-
- ///
- /// Adds a new to the end of this .
- ///
- /// The type of the data being added to this instance.
- /// The name of the data pair.
- /// The value of the data pair.
- /// The type of the data pair.
- public void Add(string name, T value, Type typeOf)
- {
- base.Add(new DataPair(name, value, typeOf));
- }
- }
-}
\ No newline at end of file
diff --git a/src/Cuemon.Core/Collections/DataPairDictionary.cs b/src/Cuemon.Core/Collections/DataPairDictionary.cs
deleted file mode 100644
index 16f0a245c..000000000
--- a/src/Cuemon.Core/Collections/DataPairDictionary.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace Cuemon.Collections
-{
- ///
- /// Provides a collection of .
- ///
- public class DataPairDictionary : Dictionary
- {
- ///
- /// Initializes a new instance of the class.
- ///
- public DataPairDictionary() : base()
- {
- }
-
- ///
- /// Adds a new to the end of this .
- ///
- /// The type of the data being added to this instance.
- /// The name of the data pair.
- /// The value of the data pair.
- public void Add(string name, T value)
- {
- Add(name, value, typeof(T));
- }
-
- ///
- /// Adds a new to the end of this .
- ///
- /// The type of the data being added to this instance.
- /// The name of the data pair.
- /// The value of the data pair.
- /// The type of the data pair.
- public void Add(string name, T value, Type typeOf)
- {
- base.Add(name, new DataPair(name, value, typeOf));
- }
- }
-}
\ No newline at end of file
diff --git a/src/Cuemon.Core/Extensions/ExceptionDecoratorExtensions.cs b/src/Cuemon.Core/Extensions/ExceptionDecoratorExtensions.cs
index 826258520..ab3272825 100644
--- a/src/Cuemon.Core/Extensions/ExceptionDecoratorExtensions.cs
+++ b/src/Cuemon.Core/Extensions/ExceptionDecoratorExtensions.cs
@@ -28,7 +28,7 @@ public static IEnumerable Flatten(this IDecorator decorato
{
Validator.ThrowIfNull(decorator);
if (decorator.Inner is AggregateException ae) { return ae.Flatten().InnerExceptions; }
- return Hierarchy.WhileSourceTraversalHasElements(decorator.Inner, FlattenCallback).Skip(1);
+ return Decorator.RawEnclose(decorator.Inner).TraverseWhileNotEmpty(FlattenCallback).Skip(1);
}
private static IEnumerable FlattenCallback(Exception source)
@@ -37,4 +37,4 @@ private static IEnumerable FlattenCallback(Exception source)
return source.InnerException == null ? Enumerable.Empty() : Arguments.Yield(source.InnerException);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Cuemon.Core/Extensions/ObjectDecoratorExtensions.cs b/src/Cuemon.Core/Extensions/ObjectDecoratorExtensions.cs
index 511bc9405..4cc3023f5 100644
--- a/src/Cuemon.Core/Extensions/ObjectDecoratorExtensions.cs
+++ b/src/Cuemon.Core/Extensions/ObjectDecoratorExtensions.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Reflection;
@@ -95,5 +96,48 @@ public static object ChangeType(this IDecorator
- public static IEnumerable WhileSourceTraversalHasElements(TSource source, Func> traversal) where TSource : class
+ public static IEnumerable TraverseWhileNotEmpty(TSource source, Func> traversal) where TSource : class
{
- var stack = new Stack();
- stack.Push(source);
- while (stack.Count != 0)
- {
- var current = stack.Pop();
- foreach (var element in traversal(current))
- {
- stack.Push(element);
- }
- yield return current;
- }
+ return Decorator.EncloseToExpose(source).TraverseWhileNotEmpty(traversal);
}
internal static IHierarchy AncestorsAndSelf(IHierarchy source)
diff --git a/src/Cuemon.Core/Extensions/HierarchyDecoratorExtensions.cs b/src/Cuemon.Extensions.Core/Runtime/HierarchyDecoratorExtensions.cs
similarity index 94%
rename from src/Cuemon.Core/Extensions/HierarchyDecoratorExtensions.cs
rename to src/Cuemon.Extensions.Core/Runtime/HierarchyDecoratorExtensions.cs
index 4aff91cb1..18be42f62 100644
--- a/src/Cuemon.Core/Extensions/HierarchyDecoratorExtensions.cs
+++ b/src/Cuemon.Extensions.Core/Runtime/HierarchyDecoratorExtensions.cs
@@ -6,7 +6,7 @@
using System.Reflection;
using Cuemon.Collections.Generic;
-namespace Cuemon
+namespace Cuemon.Extensions.Runtime
{
///
/// Extension methods for the interface hidden behind the interface.
@@ -69,7 +69,7 @@ public static DateTime UseDateTimeFormatter(this IDecorator
public static Guid UseGuidFormatter(this IDecorator> decorator)
{
Validator.ThrowIfNull(decorator);
- return UseGenericConverter(decorator.Inner);
+ return decorator.Inner.UseGenericConverter();
}
///
@@ -83,7 +83,7 @@ public static Guid UseGuidFormatter(this IDecorator> decora
public static string UseStringFormatter(this IDecorator> decorator)
{
Validator.ThrowIfNull(decorator);
- return UseGenericConverter(decorator.Inner);
+ return decorator.Inner.UseGenericConverter();
}
///
@@ -97,7 +97,7 @@ public static string UseStringFormatter(this IDecorator> de
public static decimal UseDecimalFormatter(this IDecorator> decorator)
{
Validator.ThrowIfNull(decorator);
- return UseGenericConverter(decorator.Inner);
+ return decorator.Inner.UseGenericConverter();
}
///
@@ -155,7 +155,7 @@ public static IDictionary UseDictionary(this IDecorator> de
/// An that match the conditions defined by the function delegate , or a default value if no node is found.
public static T FindFirstInstance(this IDecorator> decorator, Func, bool> match)
{
- return FindInstance(decorator, match).FirstOrDefault();
+ return decorator.FindInstance(match).FirstOrDefault();
}
///
@@ -167,7 +167,7 @@ public static T FindFirstInstance(this IDecorator> decorator, F
/// An node that match the conditions defined by the function delegate , or a default value if no node instance is found.
public static T FindSingleInstance(this IDecorator> decorator, Func, bool> match)
{
- return FindInstance(decorator, match).SingleOrDefault();
+ return decorator.FindInstance(match).SingleOrDefault();
}
///
@@ -179,7 +179,7 @@ public static T FindSingleInstance(this IDecorator> decorator,
/// An sequence containing all node instances that match the conditions defined by the specified predicate, if found.
public static IEnumerable FindInstance(this IDecorator> decorator, Func, bool> match)
{
- return Find(decorator, match).Select(h => h.Instance);
+ return decorator.Find(match).Select(h => h.Instance);
}
///
@@ -191,7 +191,7 @@ public static IEnumerable FindInstance(this IDecorator> deco
/// An node that match the conditions defined by the function delegate , or a default value if no node is found.
public static IHierarchy FindFirst(this IDecorator> decorator, Func, bool> match)
{
- return Find(decorator, match).FirstOrDefault();
+ return decorator.Find(match).FirstOrDefault();
}
///
@@ -203,7 +203,7 @@ public static IHierarchy FindFirst(this IDecorator> decorato
/// An node that match the conditions defined by the function delegate , or a default value if no node is found.
public static IHierarchy FindSingle(this IDecorator> decorator, Func, bool> match)
{
- return Find(decorator, match).SingleOrDefault();
+ return decorator.Find(match).SingleOrDefault();
}
///
@@ -217,7 +217,7 @@ public static IEnumerable> Find(this IDecorator>
{
Validator.ThrowIfNull(decorator);
Validator.ThrowIfNull(match);
- return DescendantsAndSelf(decorator).Where(match);
+ return decorator.DescendantsAndSelf().Where(match);
}
///
@@ -245,7 +245,7 @@ public static void ReplaceAll(this IDecorator>> dec
Validator.ThrowIfNull(replacer);
foreach (var node in decorator.Inner)
{
- Replace(Decorator.Enclose(node), replacer);
+ Decorator.Enclose(node).Replace(replacer);
}
}
@@ -261,7 +261,7 @@ public static void ReplaceAll(this IDecorator>> dec
public static IHierarchy Root(this IDecorator> decorator)
{
Validator.ThrowIfNull(decorator);
- return decorator.Inner.HasParent ? AncestorsAndSelf(decorator).FirstOrDefault() : decorator.Inner;
+ return decorator.Inner.HasParent ? decorator.AncestorsAndSelf().FirstOrDefault() : decorator.Inner;
}
///
@@ -276,7 +276,7 @@ public static IHierarchy Root(this IDecorator> decorator)
public static IEnumerable> AncestorsAndSelf(this IDecorator> decorator)
{
Validator.ThrowIfNull(decorator);
- IList> result = new List>(Hierarchy.WhileSourceTraversalIsNotNull(decorator.Inner, Hierarchy.AncestorsAndSelf));
+ IList> result = new List>(Hierarchy.TraverseWhileNotNull(decorator.Inner, Hierarchy.AncestorsAndSelf));
return result.Count > 0 ? result.Reverse() : Arguments.Yield(decorator.Inner);
}
@@ -292,7 +292,7 @@ public static IEnumerable> AncestorsAndSelf(this IDecorator> DescendantsAndSelf(this IDecorator> decorator)
{
Validator.ThrowIfNull(decorator);
- return Hierarchy.WhileSourceTraversalHasElements(decorator.Inner, Hierarchy.DescendantsAndSelf).Reverse();
+ return Hierarchy.TraverseWhileNotEmpty(decorator.Inner, Hierarchy.DescendantsAndSelf).Reverse();
}
///
@@ -307,7 +307,7 @@ public static IEnumerable> DescendantsAndSelf(this IDecorator> SiblingsAndSelf(this IDecorator> decorator)
{
Validator.ThrowIfNull(decorator);
- return SiblingsAndSelfAt(decorator, decorator.Inner.Depth);
+ return decorator.SiblingsAndSelfAt(decorator.Inner.Depth);
}
///
@@ -327,8 +327,8 @@ public static IEnumerable> SiblingsAndSelfAt(this IDecorator NodeAt(this IDecorator> decorator,
Validator.ThrowIfNull(decorator);
Validator.ThrowIfLowerThan(index, 0, nameof(index));
if (decorator.Inner.Index == index) { return decorator.Inner; }
- var allNodes = FlattenAll(decorator);
+ var allNodes = decorator.FlattenAll();
foreach (var element in allNodes)
{
if (element.Index == index) { return element; }
@@ -373,8 +373,8 @@ public static IHierarchy NodeAt(this IDecorator> decorator,
public static IEnumerable> FlattenAll(this IDecorator> decorator)
{
Validator.ThrowIfNull(decorator);
- var root = AncestorsAndSelf(decorator).FirstOrDefault();
- return DescendantsAndSelf(Decorator.Enclose(root));
+ var root = decorator.AncestorsAndSelf().FirstOrDefault();
+ return Decorator.Enclose(root).DescendantsAndSelf();
}
private static T UseGenericConverter(this IHierarchy hierarchy)
diff --git a/src/Cuemon.Core/Reflection/ObjectHierarchyOptions.cs b/src/Cuemon.Extensions.Core/Runtime/HierarchyOptions.cs
similarity index 94%
rename from src/Cuemon.Core/Reflection/ObjectHierarchyOptions.cs
rename to src/Cuemon.Extensions.Core/Runtime/HierarchyOptions.cs
index 77c05e124..3e256b046 100644
--- a/src/Cuemon.Core/Reflection/ObjectHierarchyOptions.cs
+++ b/src/Cuemon.Extensions.Core/Runtime/HierarchyOptions.cs
@@ -1,15 +1,16 @@
using System;
using System.Reflection;
using Cuemon.Configuration;
-using Cuemon.Runtime.Serialization;
+using Cuemon.Extensions.Runtime.Serialization;
+using Cuemon.Reflection;
-namespace Cuemon.Reflection
+namespace Cuemon.Extensions.Runtime
{
///
/// Specifies options that is related to and operations.
///
///
- public class ObjectHierarchyOptions : IParameterObject
+ public class HierarchyOptions : IParameterObject
{
private int _maxDepth;
private int _maxCircularCalls;
@@ -20,9 +21,9 @@ public class ObjectHierarchyOptions : IParameterObject
private MemberReflection _reflectionRules;
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
- public ObjectHierarchyOptions()
+ public HierarchyOptions()
{
MaxDepth = 10;
MaxCircularCalls = 2;
@@ -66,7 +67,7 @@ public ObjectHierarchyOptions()
property.Name.Equals("TargetSite", StringComparison.Ordinal));
};
HasCircularReference = i => Decorator.Enclose(i.GetType()).HasCircularReference(i);
- ValueResolver = Infrastructure.DefaultPropertyValueResolver;
+ ValueResolver = (s, i) => Decorator.RawEnclose(s).DefaultPropertyValueResolver(i);
}
///
diff --git a/src/Cuemon.Core/IHierarchy.cs b/src/Cuemon.Extensions.Core/Runtime/IHierarchy.cs
similarity index 97%
rename from src/Cuemon.Core/IHierarchy.cs
rename to src/Cuemon.Extensions.Core/Runtime/IHierarchy.cs
index a9b8eb0eb..576b898e6 100644
--- a/src/Cuemon.Core/IHierarchy.cs
+++ b/src/Cuemon.Extensions.Core/Runtime/IHierarchy.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Reflection;
-namespace Cuemon
+namespace Cuemon.Extensions.Runtime
{
///
/// Provides a generic way to expose a node of a hierarchical structure, including the node object of type .
@@ -10,7 +10,6 @@ namespace Cuemon
/// The type of the node represented in the hierarchical structure.
public interface IHierarchy : IWrapper
{
- #region Properties
///
/// Indicates whether the current node has a parent node.
///
@@ -40,9 +39,7 @@ public interface IHierarchy : IWrapper
///
/// The node at the specified index.
IHierarchy this[int index] { get; }
- #endregion
- #region Methods
///
/// Adds the specified instance to a node in the hierarchical structure representation.
///
@@ -88,6 +85,5 @@ public interface IHierarchy : IWrapper
///
/// An sequence that represents all the child nodes of the current hierarchical node.
IEnumerable> GetChildren();
- #endregion
}
-}
\ No newline at end of file
+}
diff --git a/src/Cuemon.Core/Runtime/Serialization/HierarchySerializer.cs b/src/Cuemon.Extensions.Core/Runtime/Serialization/HierarchySerializer.cs
similarity index 85%
rename from src/Cuemon.Core/Runtime/Serialization/HierarchySerializer.cs
rename to src/Cuemon.Extensions.Core/Runtime/Serialization/HierarchySerializer.cs
index 9189e0472..bed41e2a6 100644
--- a/src/Cuemon.Core/Runtime/Serialization/HierarchySerializer.cs
+++ b/src/Cuemon.Extensions.Core/Runtime/Serialization/HierarchySerializer.cs
@@ -1,8 +1,7 @@
using System;
using System.Text;
-using Cuemon.Reflection;
-namespace Cuemon.Runtime.Serialization
+namespace Cuemon.Extensions.Runtime.Serialization
{
///
/// Provides a way to serialize objects to nodes of .
@@ -13,8 +12,8 @@ public class HierarchySerializer
/// Initializes a new instance of the class.
///
/// The object to convert to nodes of .
- /// The which need to be configured.
- public HierarchySerializer(object source, Action setup = null)
+ /// The which need to be configured.
+ public HierarchySerializer(object source, Action setup = null)
{
Nodes = Decorator.Enclose(Hierarchy.GetObjectHierarchy(source, setup)).Root();
}
diff --git a/src/Cuemon.Core/VerticalDirection.cs b/src/Cuemon.Extensions.Core/VerticalDirection.cs
similarity index 91%
rename from src/Cuemon.Core/VerticalDirection.cs
rename to src/Cuemon.Extensions.Core/VerticalDirection.cs
index 7c49e010f..ee131a851 100644
--- a/src/Cuemon.Core/VerticalDirection.cs
+++ b/src/Cuemon.Extensions.Core/VerticalDirection.cs
@@ -1,4 +1,4 @@
-namespace Cuemon
+namespace Cuemon.Extensions
{
///
/// Specifies a set of values defining a vertical direction.
@@ -14,4 +14,4 @@ public enum VerticalDirection
///
Up
}
-}
\ No newline at end of file
+}
diff --git a/src/Cuemon.Core/Wrapper.cs b/src/Cuemon.Extensions.Core/Wrapper.cs
similarity index 98%
rename from src/Cuemon.Core/Wrapper.cs
rename to src/Cuemon.Extensions.Core/Wrapper.cs
index 4d5e9f237..ad13b6fb8 100644
--- a/src/Cuemon.Core/Wrapper.cs
+++ b/src/Cuemon.Extensions.Core/Wrapper.cs
@@ -3,7 +3,7 @@
using System.Globalization;
using System.Reflection;
-namespace Cuemon
+namespace Cuemon.Extensions
{
///
/// Provides helper method for a object.
@@ -84,7 +84,6 @@ public class Wrapper : IWrapper
private Type _instanceType;
private MemberInfo _memberReference;
- #region Constructors
///
/// Initializes a new instance of the class.
///
@@ -103,9 +102,7 @@ public Wrapper(T instance, MemberInfo memberReference = null)
_instanceType = instance.GetType();
_memberReference = memberReference;
}
- #endregion
- #region Properties
///
/// Gets the object that this wrapper represents.
///
@@ -148,9 +145,6 @@ public virtual MemberInfo MemberReference
/// An object that implements the interface and contains a collection of user-defined key/value pairs.
public virtual IDictionary Data { get; } = new Dictionary();
- #endregion
-
- #region Methods
///
/// Returns a value that is equivalent to the instance of the object that this wrapper represents.
///
@@ -199,6 +193,5 @@ public override string ToString()
{
return Wrapper.ParseInstance(this);
}
- #endregion
}
}
diff --git a/src/Cuemon.Extensions.Text.Json/GlobalSuppressions.cs b/src/Cuemon.Extensions.Text.Json/GlobalSuppressions.cs
index cbabe6827..5d5c3bb5b 100644
--- a/src/Cuemon.Extensions.Text.Json/GlobalSuppressions.cs
+++ b/src/Cuemon.Extensions.Text.Json/GlobalSuppressions.cs
@@ -5,6 +5,4 @@
using System.Diagnostics.CodeAnalysis;
-[assembly: SuppressMessage("Critical Code Smell", "S3776:Cognitive Complexity of methods should not be too high", Justification = "Transitioned legacy code ;-)", Scope = "member", Target = "~M:Cuemon.Extensions.Text.Json.JsonReaderExtensions.ToHierarchy(System.Text.Json.Utf8JsonReader)~Cuemon.IHierarchy{Cuemon.DataPair}")]
-[assembly: SuppressMessage("Major Code Smell", "S907:\"goto\" statement should not be used", Justification = "Transitioned legacy code ;-)", Scope = "member", Target = "~M:Cuemon.Extensions.Text.Json.JsonReaderExtensions.ToHierarchy(System.Text.Json.Utf8JsonReader)~Cuemon.IHierarchy{Cuemon.DataPair}")]
[assembly: SuppressMessage("CodeQuality", "IDE0052:Remove unread private members", Justification = "False-positive; .NET 7 reads this value.", Scope = "member", Target = "~P:Cuemon.Extensions.Text.Json.Converters.FlagsEnumConverter.TypeToConvert")]
diff --git a/src/Cuemon.Extensions.Text.Json/JsonReaderExtensions.cs b/src/Cuemon.Extensions.Text.Json/JsonReaderExtensions.cs
deleted file mode 100644
index f5b4bae91..000000000
--- a/src/Cuemon.Extensions.Text.Json/JsonReaderExtensions.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using System.Collections.Generic;
-using System.Text.Json;
-using Cuemon.Text;
-using Cuemon.Collections.Generic;
-
-namespace Cuemon.Extensions.Text.Json
-{
- ///
- /// Extension methods for the struct.
- ///
- public static class JsonReaderExtensions
- {
- private const string PropertyNameKey = "reader.Value";
-
- ///
- /// Converts the JSON hierarchy of an into an .
- ///
- /// The reader to convert.
- /// An implementation that uses .
- public static IHierarchy ToHierarchy(this Utf8JsonReader reader)
- {
- var index = 0;
- var depthIndexes = new Dictionary>();
- var dimension = 0;
- IHierarchy hierarchy = new Hierarchy();
- var array = new List();
- hierarchy.Add(new DataPair("root", null, typeof(string)));
- while (reader.Read())
- {
- object typeStrongValue;
- switch (reader.TokenType)
- {
- case JsonTokenType.StartArray:
- if (reader.TokenType == JsonTokenType.EndArray) { goto case JsonTokenType.EndArray; }
- if (reader.TokenType != JsonTokenType.StartArray && reader.TokenType != JsonTokenType.StartObject && reader.TokenType != JsonTokenType.EndObject)
- {
- typeStrongValue = ParserFactory.FromValueType().Parse(reader.GetString());
- array.Add(new DataPair(hierarchy[index].Data[PropertyNameKey]?.ToString(), typeStrongValue, typeStrongValue.GetType()));
- }
- while (reader.Read()) { goto case JsonTokenType.StartArray; }
- break;
- case JsonTokenType.PropertyName:
- hierarchy[Decorator.Enclose(depthIndexes).GetDepthIndex(reader.CurrentDepth, index, dimension)].Add(new DataPair(reader.GetString(), null, typeof(string))).Data.Add(PropertyNameKey, reader.GetString());
- index++;
- break;
- case JsonTokenType.EndArray:
- var indexCopy = index;
- foreach (var item in array)
- {
- hierarchy[indexCopy].Add(item);
- index++;
- }
- array.Clear();
- break;
- case JsonTokenType.EndObject:
- if (reader.CurrentDepth == 1) { dimension++; }
- break;
- case JsonTokenType.Number:
- case JsonTokenType.String:
- case JsonTokenType.True:
- case JsonTokenType.False:
- case JsonTokenType.Null:
- typeStrongValue = ParserFactory.FromValueType().Parse(reader.GetString());
- hierarchy[index].Replace(new DataPair(hierarchy[index].Data[PropertyNameKey]?.ToString(), typeStrongValue, typeStrongValue.GetType()));
- hierarchy[index].Data.Remove(PropertyNameKey);
- break;
- }
- }
- return hierarchy;
- }
- }
-}
diff --git a/src/Cuemon.Extensions.Xml/HierarchyExtensions.cs b/src/Cuemon.Extensions.Xml/HierarchyExtensions.cs
index e07cdedca..eba9edd48 100644
--- a/src/Cuemon.Extensions.Xml/HierarchyExtensions.cs
+++ b/src/Cuemon.Extensions.Xml/HierarchyExtensions.cs
@@ -2,6 +2,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Xml.Serialization;
+using Cuemon.Extensions.Runtime;
using Cuemon.Xml;
using Cuemon.Xml.Serialization;
@@ -74,4 +75,4 @@ public static IEnumerable> OrderByXmlAttributes(this IEnumerabl
return Decorator.Enclose(hierarchies).OrderByXmlAttributes();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Cuemon.Extensions.Xml/XmlReaderExtensions.cs b/src/Cuemon.Extensions.Xml/XmlReaderExtensions.cs
index f1253c6a7..5de92055b 100644
--- a/src/Cuemon.Extensions.Xml/XmlReaderExtensions.cs
+++ b/src/Cuemon.Extensions.Xml/XmlReaderExtensions.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Xml;
+using Cuemon.Extensions.Runtime;
using Cuemon.Xml;
namespace Cuemon.Extensions.Xml
diff --git a/src/Cuemon.Xml/Cuemon.Xml.csproj b/src/Cuemon.Xml/Cuemon.Xml.csproj
index 58b6ca218..02f7aa648 100644
--- a/src/Cuemon.Xml/Cuemon.Xml.csproj
+++ b/src/Cuemon.Xml/Cuemon.Xml.csproj
@@ -11,7 +11,8 @@
+
-
\ No newline at end of file
+
diff --git a/src/Cuemon.Xml/Extensions/HierarchyDecoratorExtensions.cs b/src/Cuemon.Xml/Extensions/HierarchyDecoratorExtensions.cs
index 0ea6d868c..8c48a1345 100644
--- a/src/Cuemon.Xml/Extensions/HierarchyDecoratorExtensions.cs
+++ b/src/Cuemon.Xml/Extensions/HierarchyDecoratorExtensions.cs
@@ -4,6 +4,7 @@
using System.Linq;
using System.Reflection;
using System.Xml.Serialization;
+using Cuemon.Extensions.Runtime;
using Cuemon.Reflection;
using Cuemon.Xml.Serialization;
diff --git a/src/Cuemon.Xml/Extensions/Serialization/Converters/XmlConverterDecoratorExtensions.cs b/src/Cuemon.Xml/Extensions/Serialization/Converters/XmlConverterDecoratorExtensions.cs
index 85b4b2287..4310b99b1 100644
--- a/src/Cuemon.Xml/Extensions/Serialization/Converters/XmlConverterDecoratorExtensions.cs
+++ b/src/Cuemon.Xml/Extensions/Serialization/Converters/XmlConverterDecoratorExtensions.cs
@@ -5,6 +5,7 @@
using System.Linq;
using System.Xml;
using Cuemon.Diagnostics;
+using Cuemon.Extensions.Runtime;
using Cuemon.Xml.Linq;
namespace Cuemon.Xml.Serialization.Converters
diff --git a/src/Cuemon.Xml/Extensions/XmlReaderDecoratorExtensions.cs b/src/Cuemon.Xml/Extensions/XmlReaderDecoratorExtensions.cs
index 351a61ad2..0273ee419 100644
--- a/src/Cuemon.Xml/Extensions/XmlReaderDecoratorExtensions.cs
+++ b/src/Cuemon.Xml/Extensions/XmlReaderDecoratorExtensions.cs
@@ -5,6 +5,7 @@
using System.Xml.XPath;
using Cuemon.Text;
using Cuemon.Collections.Generic;
+using Cuemon.Extensions.Runtime;
using Cuemon.Xml.Serialization;
namespace Cuemon.Xml
diff --git a/src/Cuemon.Xml/Extensions/XmlWriterDecoratorExtensions.cs b/src/Cuemon.Xml/Extensions/XmlWriterDecoratorExtensions.cs
index 2e9c13eab..711588a4c 100644
--- a/src/Cuemon.Xml/Extensions/XmlWriterDecoratorExtensions.cs
+++ b/src/Cuemon.Xml/Extensions/XmlWriterDecoratorExtensions.cs
@@ -2,7 +2,8 @@
using System.Reflection;
using System.Xml;
using Cuemon.Collections.Generic;
-using Cuemon.Runtime.Serialization;
+using Cuemon.Extensions.Runtime;
+using Cuemon.Extensions.Runtime.Serialization;
using Cuemon.Xml.Serialization;
using Cuemon.Xml.Serialization.Formatters;
diff --git a/src/Cuemon.Xml/GlobalSuppressions.cs b/src/Cuemon.Xml/GlobalSuppressions.cs
index 1e1230d11..f02a27557 100644
--- a/src/Cuemon.Xml/GlobalSuppressions.cs
+++ b/src/Cuemon.Xml/GlobalSuppressions.cs
@@ -7,8 +7,6 @@
[assembly: SuppressMessage("Major Code Smell", "S907:\"goto\" statement should not be used", Justification = "Legacy implementation.", Scope = "member", Target = "~M:Cuemon.Xml.Serialization.Converters.DefaultXmlConverter.ParseReadXmlDefault(System.Xml.XmlReader,System.Type)~System.Object")]
[assembly: SuppressMessage("Minor Code Smell", "S3626:Jump statements should not be redundant", Justification = "False-positive.", Scope = "member", Target = "~M:Cuemon.Xml.XmlStreamFactory.CreateStream(System.Action{System.Xml.XmlWriter},System.Action{System.Xml.XmlWriterSettings})~System.IO.Stream")]
-[assembly: SuppressMessage("Major Code Smell", "S907:\"goto\" statement should not be used", Justification = "Legacy implementation.", Scope = "member", Target = "~M:Cuemon.Xml.XmlReaderDecoratorExtensions.BuildHierarchy(System.Xml.XmlReader)~Cuemon.IHierarchy{Cuemon.DataPair}")]
-[assembly: SuppressMessage("Major Code Smell", "S1066:Collapsible \"if\" statements should be merged", Justification = "Readability; at least for me.", Scope = "member", Target = "~M:Cuemon.Xml.Serialization.Converters.DefaultXmlConverter.SkipIfNullOrEmptyEnumerable(Cuemon.IHierarchy{System.Object})~System.Boolean")]
[assembly: SuppressMessage("Critical Bug", "S4275:Getters and setters should access the expected fields", Justification = "By design; to provide XmlIgnoreAttribute.", Scope = "member", Target = "~P:Cuemon.Xml.Serialization.XmlWrapper.InstanceType")]
[assembly: SuppressMessage("Critical Bug", "S4275:Getters and setters should access the expected fields", Justification = "By design; to provide XmlIgnoreAttribute.", Scope = "member", Target = "~P:Cuemon.Xml.Serialization.XmlWrapper.MemberReference")]
[assembly: SuppressMessage("Style", "IDE0130:Namespace does not match folder structure", Justification = "Intentional as these embark on IDecorator.", Scope = "namespace", Target = "~N:Cuemon.Xml")]
@@ -18,3 +16,7 @@
[assembly: SuppressMessage("Security", "CA5372:Use XmlReader for XPathDocument constructor", Justification = "Convenience.", Scope = "member", Target = "~M:Cuemon.Xml.XPath.XPathDocumentFactory.CreateDocument(System.Uri)~System.Xml.XPath.XPathDocument")]
[assembly: SuppressMessage("Security", "CA5372:Use XmlReader for XPathDocument constructor", Justification = "Convenience.", Scope = "member", Target = "~M:Cuemon.Xml.XPath.XPathDocumentFactory.CreateDocument(System.IO.Stream,System.Boolean)~System.Xml.XPath.XPathDocument")]
[assembly: SuppressMessage("Major Code Smell", "S1172:Unused method parameters should be removed", Justification = "False-positive; value is conditionally used.", Scope = "member", Target = "~M:Cuemon.Xml.Serialization.Converters.ExceptionConverter.ParseXmlReader(System.Xml.XmlReader,System.Type)~System.Collections.Generic.Stack{System.Collections.Generic.IList{Cuemon.Reflection.MemberArgument}}")]
+[assembly: SuppressMessage("Critical Code Smell", "S3776:Cognitive Complexity of methods should not be too high", Justification = "TODO - due to .NET 9 release this week, its kept as-is with this round of refactoring.", Scope = "member", Target = "~M:Cuemon.Xml.XmlReaderDecoratorExtensions.BuildHierarchy(System.Xml.XmlReader)~Cuemon.Extensions.Runtime.IHierarchy{Cuemon.DataPair}")]
+[assembly: SuppressMessage("Critical Code Smell", "S3776:Cognitive Complexity of methods should not be too high", Justification = "TODO - due to .NET 9 release this week, its kept as-is with this round of refactoring.", Scope = "member", Target = "~M:Cuemon.Xml.Serialization.Converters.XmlConverterDecoratorExtensions.AddEnumerableConverter(Cuemon.IDecorator{System.Collections.Generic.IList{Cuemon.Xml.Serialization.Converters.XmlConverter}})~Cuemon.IDecorator{System.Collections.Generic.IList{Cuemon.Xml.Serialization.Converters.XmlConverter}}")]
+[assembly: SuppressMessage("Critical Code Smell", "S3776:Cognitive Complexity of methods should not be too high", Justification = "TODO - due to .NET 9 release this week, its kept as-is with this round of refactoring.", Scope = "member", Target = "~M:Cuemon.Xml.Serialization.Converters.DefaultXmlConverter.ParseReadXmlDefault(System.Xml.XmlReader,System.Type)~System.Object")]
+[assembly: SuppressMessage("Critical Code Smell", "S3776:Cognitive Complexity of methods should not be too high", Justification = "TODO - due to .NET 9 release this week, its kept as-is with this round of refactoring.", Scope = "member", Target = "~M:Cuemon.Xml.Serialization.Converters.ExceptionConverter.ParseXmlReader(System.Xml.XmlReader,System.Type)~System.Collections.Generic.Stack{System.Collections.Generic.IList{Cuemon.Reflection.MemberArgument}}")]
diff --git a/src/Cuemon.Xml/Serialization/Converters/DefaultXmlConverter.cs b/src/Cuemon.Xml/Serialization/Converters/DefaultXmlConverter.cs
index cbc4ef64e..bc9e3f7fa 100644
--- a/src/Cuemon.Xml/Serialization/Converters/DefaultXmlConverter.cs
+++ b/src/Cuemon.Xml/Serialization/Converters/DefaultXmlConverter.cs
@@ -8,6 +8,8 @@
using System.Xml;
using System.Xml.Serialization;
using Cuemon.Collections.Generic;
+using Cuemon.Extensions;
+using Cuemon.Extensions.Runtime;
using Cuemon.Reflection;
using Cuemon.Xml.Linq;
diff --git a/src/Cuemon.Xml/Serialization/XmlWrapper.cs b/src/Cuemon.Xml/Serialization/XmlWrapper.cs
index ed87c3daf..104bfa528 100644
--- a/src/Cuemon.Xml/Serialization/XmlWrapper.cs
+++ b/src/Cuemon.Xml/Serialization/XmlWrapper.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Reflection;
using System.Xml.Serialization;
+using Cuemon.Extensions;
namespace Cuemon.Xml.Serialization
{
diff --git a/test/Cuemon.Core.Tests/Reflection/AssemblyDecoratorExtensionsTest.cs b/test/Cuemon.Core.Tests/Reflection/AssemblyDecoratorExtensionsTest.cs
index 269720070..a86b4d515 100644
--- a/test/Cuemon.Core.Tests/Reflection/AssemblyDecoratorExtensionsTest.cs
+++ b/test/Cuemon.Core.Tests/Reflection/AssemblyDecoratorExtensionsTest.cs
@@ -41,7 +41,7 @@ public void GetTypes_ShouldReturnAllTypesFromCuemonCore()
TestOutput.WriteLine(disposableTypes.ToDelimitedString());
- Assert.InRange(allTypesCount, 375, 425); // range because of tooling on CI adding dynamic types and high range of refactoring
+ Assert.InRange(allTypesCount, 325, 375); // range because of tooling on CI adding dynamic types and high range of refactoring
Assert.Equal(5, disposableTypesCount);
Assert.Equal(4, configurationTypesCount);
}
diff --git a/test/Cuemon.Core.Tests/Runtime/Serialization/HierarchySerializerTest.cs b/test/Cuemon.Core.Tests/Runtime/Serialization/HierarchySerializerTest.cs
index ff91bdcef..c93eb29b9 100644
--- a/test/Cuemon.Core.Tests/Runtime/Serialization/HierarchySerializerTest.cs
+++ b/test/Cuemon.Core.Tests/Runtime/Serialization/HierarchySerializerTest.cs
@@ -1,5 +1,6 @@
using Cuemon.Assets;
using Codebelt.Extensions.Xunit;
+using Cuemon.Extensions.Runtime.Serialization;
using Xunit;
using Xunit.Abstractions;
diff --git a/test/Cuemon.Core.Tests/Text/ParserFactoryTest.cs b/test/Cuemon.Core.Tests/Text/ParserFactoryTest.cs
index 2d26445ad..03b39043e 100644
--- a/test/Cuemon.Core.Tests/Text/ParserFactoryTest.cs
+++ b/test/Cuemon.Core.Tests/Text/ParserFactoryTest.cs
@@ -2,6 +2,7 @@
using System.ComponentModel;
using System.Globalization;
using Codebelt.Extensions.Xunit;
+using Cuemon.Extensions;
using Xunit;
using Xunit.Abstractions;
diff --git a/test/Cuemon.Core.Tests/ValidatorTest.cs b/test/Cuemon.Core.Tests/ValidatorTest.cs
index 5038e7cd3..5bdf1d75f 100644
--- a/test/Cuemon.Core.Tests/ValidatorTest.cs
+++ b/test/Cuemon.Core.Tests/ValidatorTest.cs
@@ -8,6 +8,7 @@
using Cuemon.Extensions;
#endif
using Codebelt.Extensions.Xunit;
+using Cuemon.Extensions;
using Xunit;
using Xunit.Abstractions;
diff --git a/test/Cuemon.Extensions.Core.Tests/MappingExtensionsTest.cs b/test/Cuemon.Extensions.Core.Tests/MappingExtensionsTest.cs
deleted file mode 100644
index ec4ac0a54..000000000
--- a/test/Cuemon.Extensions.Core.Tests/MappingExtensionsTest.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using Codebelt.Extensions.Xunit;
-using Xunit;
-using Xunit.Abstractions;
-
-namespace Cuemon.Extensions
-{
- public class MappingExtensionsTest : Test
- {
- public MappingExtensionsTest(ITestOutputHelper output) : base(output)
- {
- }
-
- [Fact]
- public void Add_ShouldAddMappingWithStringValues()
- {
- var sut1 = new List();
- var sut2 = new List(sut1);
- var sut3 = new Mapping("Source", "Destination");
- sut2.AddMapping("Source", "Destination");
-
- Assert.Empty(sut1);
- Assert.Equal(1, sut2.Count);
- Assert.Equal(sut3.Source, sut2.Single().Source);
- Assert.Equal(sut3.Destination, sut2.Single().Destination);
- }
-
- [Fact]
- public void Add_ShouldAddIndexMappingWithOrdinalAndString()
- {
- var sut1 = new List();
- var sut2 = new List(sut1);
- var sut3 = new IndexMapping(42, "Destination");
- sut2.AddMapping(42, "Destination");
-
- Assert.Empty(sut1);
- Assert.Equal(1, sut2.Count);
- Assert.Equal(sut3.SourceIndex, sut2.Single().As().SourceIndex);
- Assert.Equal(sut3.Destination, sut2.Single().Destination);
- }
-
- [Fact]
- public void Add_ShouldAddIndexMappingWithStringAndOrdinal()
- {
- var sut1 = new List();
- var sut2 = new List(sut1);
- var sut3 = new IndexMapping("Source", 42);
- sut2.AddMapping("Source", 42);
-
- Assert.Empty(sut1);
- Assert.Equal(1, sut2.Count);
- Assert.Equal(sut3.Source, sut2.Single().Source);
- Assert.Equal(sut3.DestinationIndex, sut2.Single().As().DestinationIndex);
- }
-
- [Fact]
- public void Add_ShouldAddIndexMappingWithOrdinals()
- {
- var sut1 = new List();
- var sut2 = new List(sut1);
- var sut3 = new IndexMapping(24, 42);
- sut2.AddMapping(24, 42);
-
- Assert.Empty(sut1);
- Assert.Equal(1, sut2.Count);
- Assert.Equal(sut3.SourceIndex, sut2.Single().As().SourceIndex);
- Assert.Equal(sut3.DestinationIndex, sut2.Single().As().DestinationIndex);
- }
- }
-}
\ No newline at end of file
diff --git a/test/Cuemon.Extensions.Text.Json.Tests/Converters/JsonConverterCollectionExtensionsTest.cs b/test/Cuemon.Extensions.Text.Json.Tests/Converters/JsonConverterCollectionExtensionsTest.cs
index 41bda0b80..349b9cb4e 100644
--- a/test/Cuemon.Extensions.Text.Json.Tests/Converters/JsonConverterCollectionExtensionsTest.cs
+++ b/test/Cuemon.Extensions.Text.Json.Tests/Converters/JsonConverterCollectionExtensionsTest.cs
@@ -18,7 +18,7 @@ public JsonConverterCollectionExtensionsTest(ITestOutputHelper output) : base(ou
[Fact]
public void AddStringEnumConverter_ShouldAddStringEnumConverterToConverterCollection_WithPascalCase()
{
- var sut1 = HorizontalDirection.Left;
+ var sut1 = DayOfWeek.Friday;
var sut2 = new JsonFormatterOptions();
sut2.Settings.PropertyNamingPolicy = null; // set PascalCase
sut2.Settings.Converters.Clear();
@@ -32,8 +32,8 @@ public void AddStringEnumConverter_ShouldAddStringEnumConverterToConverterCollec
var json = result.ToEncodedString();
- Assert.True(jc.CanConvert(typeof(HorizontalDirection)));
- Assert.Equal("\"Left\"", json);
+ Assert.True(jc.CanConvert(typeof(DayOfWeek)));
+ Assert.Equal("\"Friday\"", json);
TestOutput.WriteLine(json);
});
@@ -73,7 +73,7 @@ public void AddStringFlagsEnumConverter_ShouldAddStringFlagsEnumConverterToConve
[Fact]
public void AddStringEnumConverter_ShouldAddStringEnumConverterToConverterCollection()
{
- var sut1 = HorizontalDirection.Left;
+ var sut1 = DayOfWeek.Friday;
var sut2 = new JsonFormatterOptions();
sut2.Settings.Converters.Clear();
sut2.Settings.Converters.AddStringEnumConverter();
@@ -86,8 +86,8 @@ public void AddStringEnumConverter_ShouldAddStringEnumConverterToConverterCollec
var json = result.ToEncodedString();
- Assert.True(jc.CanConvert(typeof(HorizontalDirection)));
- Assert.Equal("\"left\"", json);
+ Assert.True(jc.CanConvert(typeof(DayOfWeek)));
+ Assert.Equal("\"friday\"", json);
TestOutput.WriteLine(json);
});
diff --git a/test/Cuemon.Extensions.Xml.Tests/XmlReaderExtensionsTest.cs b/test/Cuemon.Extensions.Xml.Tests/XmlReaderExtensionsTest.cs
index 722e71be4..6b163e1f2 100644
--- a/test/Cuemon.Extensions.Xml.Tests/XmlReaderExtensionsTest.cs
+++ b/test/Cuemon.Extensions.Xml.Tests/XmlReaderExtensionsTest.cs
@@ -4,7 +4,7 @@
using Cuemon.Extensions.IO;
using Cuemon.Extensions.Xml.Assets;
using Codebelt.Extensions.Xunit;
-using Cuemon.Runtime.Serialization;
+using Cuemon.Extensions.Runtime.Serialization;
using Cuemon.Xml.Serialization.Formatters;
using Xunit;
using Xunit.Abstractions;
@@ -112,6 +112,7 @@ public void ToHierarchy_ShouldConvertReaderToHierarchy()
var sut4 = sut3.ToHierarchy();
var sut5 = sut4.GetChildren(); // namespace
+ TestOutput.WriteLine(sut1.ToString());
TestOutput.WriteLine(sut2.ToEncodedString());
Assert.NotNull(sut3);
diff --git a/test/Cuemon.Security.Cryptography.Tests/UnkeyedHashFactoryTest.cs b/test/Cuemon.Security.Cryptography.Tests/UnkeyedHashFactoryTest.cs
index 8b0646ad3..aa72f9f5a 100644
--- a/test/Cuemon.Security.Cryptography.Tests/UnkeyedHashFactoryTest.cs
+++ b/test/Cuemon.Security.Cryptography.Tests/UnkeyedHashFactoryTest.cs
@@ -26,7 +26,7 @@ public void CreateCryptoSha384_ShouldBeValidHashResult()
var h = UnkeyedHashFactory.CreateCryptoSha384();
Assert.Equal("1761336e3f7cbfe51deb137f026f89e01a448e3b1fafa64039c1464ee8732f11a5341a6f41e0c202294736ed64db1a84", h.ComputeHash(Alphanumeric.LettersAndNumbers).ToHexadecimalString());
Assert.Equal("90ae531f24e48697904a4d0286f354c50a350ebb6c2b9efcb22f71c96ceaeffc11c6095e9ca0df0ec30bf685dcf2e5e5", h.ComputeHash(Alphanumeric.Numbers).ToHexadecimalString());
- Assert.Equal("7210af19145ec2a8e250a7fe8e9eeeac1301e524daab82366c36be614dc35402a289101e48cad61c45337f2f32c14fdc", h.ComputeHash(VerticalDirection.Up).ToHexadecimalString());
+ Assert.Equal("d3b3f28933c5c91daa6a355aef5e09252e9c78baf751db717a2fde4b88e962a55e740acd869a3057b6020ad68e650a5f", h.ComputeHash(DayOfWeek.Friday).ToHexadecimalString());
}
[Fact]