diff --git a/LightweightIocContainer.Validation/IocValidator.cs b/LightweightIocContainer.Validation/IocValidator.cs
index d408e2a..12065eb 100644
--- a/LightweightIocContainer.Validation/IocValidator.cs
+++ b/LightweightIocContainer.Validation/IocValidator.cs
@@ -11,20 +11,9 @@ namespace LightweightIocContainer.Validation;
///
/// Validator for your to check if everything can be resolved with your current setup
///
-public class IocValidator
+public class IocValidator(IocContainer iocContainer)
{
- private readonly IocContainer _iocContainer;
- private readonly List<(Type type, object? parameter)> _parameters;
-
- ///
- /// Validator for your to check if everything can be resolved with your current setup
- ///
- /// The
- public IocValidator(IocContainer iocContainer)
- {
- _iocContainer = iocContainer;
- _parameters = new List<(Type, object?)>();
- }
+ private readonly List<(Type type, object? parameter)> _parameters = [];
///
/// Add parameters that can't be default for your type to be created successfully
@@ -40,13 +29,13 @@ public class IocValidator
///
public void Validate()
{
- List validationExceptions = new();
+ List validationExceptions = [];
- foreach (IRegistration registration in _iocContainer.Registrations)
+ foreach (IRegistration registration in iocContainer.Registrations)
{
var definedParameters = _parameters.Where(p => p.type == registration.InterfaceType);
- if (registration is IWithFactoryInternal { Factory: { } } withFactoryRegistration)
+ if (registration is IWithFactoryInternal { Factory: not null } withFactoryRegistration)
{
(from createMethod in withFactoryRegistration.Factory.CreateMethods.Where(m => m.ReturnType == registration.InterfaceType)
select createMethod.GetParameters().Select(p => p.ParameterType)
@@ -71,7 +60,7 @@ public class IocValidator
private void TryResolve(Type type, object?[]? arguments, List validationExceptions, bool isFactoryResolve = false)
{
- (bool success, object _, Exception? exception) = _iocContainer.TryResolveNonGeneric(type, arguments, null, isFactoryResolve);
+ (bool success, object _, Exception? exception) = iocContainer.TryResolveNonGeneric(type, arguments, null, isFactoryResolve);
if (success)
return;
diff --git a/LightweightIocContainer/Exceptions/CircularDependencyException.cs b/LightweightIocContainer/Exceptions/CircularDependencyException.cs
index 02993a4..e6c282f 100644
--- a/LightweightIocContainer/Exceptions/CircularDependencyException.cs
+++ b/LightweightIocContainer/Exceptions/CircularDependencyException.cs
@@ -22,7 +22,6 @@ internal class CircularDependencyException : IocContainerException
ResolveStack = resolveStack;
}
-
///
/// The currently resolving
///
diff --git a/LightweightIocContainer/Exceptions/IocContainerException.cs b/LightweightIocContainer/Exceptions/IocContainerException.cs
index d944cfc..f50607f 100644
--- a/LightweightIocContainer/Exceptions/IocContainerException.cs
+++ b/LightweightIocContainer/Exceptions/IocContainerException.cs
@@ -12,7 +12,7 @@ public abstract class IocContainerException : Exception
///
/// A base for the
///
- protected IocContainerException() => InnerExceptions = new List();
+ protected IocContainerException() => InnerExceptions = [];
///
/// A base for the
@@ -20,7 +20,7 @@ public abstract class IocContainerException : Exception
/// The message of the
protected IocContainerException(string message)
: base(message) =>
- InnerExceptions = new List();
+ InnerExceptions = [];
///
/// A base for the
@@ -29,7 +29,7 @@ public abstract class IocContainerException : Exception
/// The inner
protected IocContainerException(string message, Exception innerException)
: base(message, innerException) =>
- InnerExceptions = new List {innerException};
+ InnerExceptions = [innerException];
///
/// The inner exceptions of the
diff --git a/LightweightIocContainer/Exceptions/NoMatchingConstructorFoundException.cs b/LightweightIocContainer/Exceptions/NoMatchingConstructorFoundException.cs
index 7704bfa..fa82e6c 100644
--- a/LightweightIocContainer/Exceptions/NoMatchingConstructorFoundException.cs
+++ b/LightweightIocContainer/Exceptions/NoMatchingConstructorFoundException.cs
@@ -17,7 +17,7 @@ internal class NoMatchingConstructorFoundException : IocContainerException
: base($"No matching constructor for {type} found.")
{
Type = type;
- InnerExceptions = new List();
+ InnerExceptions = [];
}
diff --git a/LightweightIocContainer/Factories/CustomTypedFactory.cs b/LightweightIocContainer/Factories/CustomTypedFactory.cs
index e13a4d3..512ba0c 100644
--- a/LightweightIocContainer/Factories/CustomTypedFactory.cs
+++ b/LightweightIocContainer/Factories/CustomTypedFactory.cs
@@ -9,7 +9,4 @@ namespace LightweightIocContainer.Factories;
///
/// implementation for custom implemented factories
///
-public class CustomTypedFactory : TypedFactoryBase
-{
-
-}
\ No newline at end of file
+public class CustomTypedFactory : TypedFactoryBase;
\ No newline at end of file
diff --git a/LightweightIocContainer/Installers/AssemblyInstaller.cs b/LightweightIocContainer/Installers/AssemblyInstaller.cs
index be6740b..4956531 100644
--- a/LightweightIocContainer/Installers/AssemblyInstaller.cs
+++ b/LightweightIocContainer/Installers/AssemblyInstaller.cs
@@ -20,7 +20,7 @@ public class AssemblyInstaller : IAssemblyInstaller
/// The from where the s will be installed
public AssemblyInstaller(Assembly assembly)
{
- Installers = new List();
+ Installers = [];
Type[] types = assembly.GetTypes();
foreach (Type type in types)
diff --git a/LightweightIocContainer/IocContainer.cs b/LightweightIocContainer/IocContainer.cs
index 9a87c67..404b561 100644
--- a/LightweightIocContainer/IocContainer.cs
+++ b/LightweightIocContainer/IocContainer.cs
@@ -21,23 +21,18 @@ public class IocContainer : IIocContainer, IIocResolver
{
private readonly RegistrationFactory _registrationFactory;
- private readonly List<(Type type, object? instance)> _singletons = new();
- private readonly List<(Type type, Type scope, Dictionary instances)> _multitons = new();
+ private readonly List<(Type type, object? instance)> _singletons = [];
+ private readonly List<(Type type, Type scope, Dictionary instances)> _multitons = [];
- private readonly List _ignoreConstructorAttributes;
+ private readonly List _ignoreConstructorAttributes = [];
///
/// The main container that carries all the s and can resolve all the types you'll ever want
///
- public IocContainer()
- {
- _registrationFactory = new RegistrationFactory(this);
- _ignoreConstructorAttributes = new List();
- Registrations = new List();
- }
+ public IocContainer() => _registrationFactory = new RegistrationFactory(this);
+
+ internal List Registrations { get; } = [];
- internal List Registrations { get; }
-
///
/// Install the given installers for the current
///
@@ -195,7 +190,7 @@ public class IocContainer : IIocContainer, IIocResolver
if (registration == null)
return (false, new object(), new TypeNotRegisteredException(typeof(T)));
- List internalResolveStack = resolveStack == null ? new List() : new List(resolveStack);
+ List internalResolveStack = resolveStack == null ? [] : [..resolveStack];
(bool success, internalResolveStack, CircularDependencyException? circularDependencyException) = CheckForCircularDependencies(internalResolveStack);
if (!success && circularDependencyException is not null)
@@ -232,7 +227,7 @@ public class IocContainer : IIocContainer, IIocResolver
object multitonScopeArgument = TryGetMultitonScopeArgument(multitonRegistration, arguments);
- parametersToResolve ??= new List();
+ parametersToResolve ??= [];
parametersToResolve.Insert(0, multitonScopeArgument); //insert scope at first place, won't be passed to ctor when creating multiton
}
@@ -267,7 +262,7 @@ public class IocContainer : IIocContainer, IIocResolver
if (genericMethod == null)
throw new GenericMethodNotFoundException(nameof(TryResolve));
- object? resolvedValue = genericMethod.Invoke(this, new object?[]{arguments, resolveStack, isFactoryResolve});
+ object? resolvedValue = genericMethod.Invoke(this, [arguments, resolveStack, isFactoryResolve]);
if (resolvedValue is not ValueTuple resolvedTuple)
throw new Exception("Invalid return value!");
@@ -600,12 +595,12 @@ public class IocContainer : IIocContainer, IIocResolver
{
List constructorParameters = constructor.GetParameters().ToList();
- List exceptions = new();
- List parameters = new();
+ List exceptions = [];
+ List parameters = [];
List? passedArguments = null;
if (arguments != null)
- passedArguments = new List(arguments);
+ passedArguments = [..arguments];
foreach (ParameterInfo parameter in constructorParameters)
{
@@ -745,9 +740,9 @@ public class IocContainer : IIocContainer, IIocResolver
private (bool success, List resolveStack, CircularDependencyException? exception) CheckForCircularDependencies(List? resolveStack)
{
if (resolveStack == null) //first resolve call
- resolveStack = new List {typeof(T)}; //create new stack and add the currently resolving type to the stack
+ resolveStack = [typeof(T)]; //create new stack and add the currently resolving type to the stack
else if (resolveStack.Contains(typeof(T)))
- return (false, new List(), new CircularDependencyException(typeof(T), resolveStack)); //currently resolving type is still resolving -> circular dependency
+ return (false, [], new CircularDependencyException(typeof(T), resolveStack)); //currently resolving type is still resolving -> circular dependency
else //not the first resolve call in chain but no circular dependencies for now
resolveStack.Add(typeof(T)); //add currently resolving type to the stack
diff --git a/LightweightIocContainer/Registrations/MultipleMultitonRegistration.cs b/LightweightIocContainer/Registrations/MultipleMultitonRegistration.cs
index 3afe7d4..bc7680c 100644
--- a/LightweightIocContainer/Registrations/MultipleMultitonRegistration.cs
+++ b/LightweightIocContainer/Registrations/MultipleMultitonRegistration.cs
@@ -26,11 +26,11 @@ internal class MultipleMultitonRegistration
- {
+ Registrations =
+ [
new MultitonRegistration(interfaceType1, implementationType, scope, container),
new MultitonRegistration(interfaceType2, implementationType, scope, container)
- };
+ ];
}
///
diff --git a/LightweightIocContainer/Registrations/MultipleRegistration.cs b/LightweightIocContainer/Registrations/MultipleRegistration.cs
index c957f75..d5732a7 100644
--- a/LightweightIocContainer/Registrations/MultipleRegistration.cs
+++ b/LightweightIocContainer/Registrations/MultipleRegistration.cs
@@ -22,13 +22,15 @@ internal abstract class MultipleRegistration : Typ
/// The of this
/// The current instance of the
protected MultipleRegistration(Type interfaceType1, Type implementationType, Lifestyle lifestyle, IocContainer container)
- : base(interfaceType1, implementationType, lifestyle, container) =>
- Registrations = new List();
+ : base(interfaceType1, implementationType, lifestyle, container)
+ {
+
+ }
///
/// A of s that are registered within this
///
- public List Registrations { get; protected init; }
+ public List Registrations { get; protected init; } = [];
}
///
@@ -50,11 +52,11 @@ internal class MultipleRegistration :
public MultipleRegistration(Type interfaceType1, Type interfaceType2, Type implementationType, Lifestyle lifestyle, IocContainer container)
: base(interfaceType1, implementationType, lifestyle, container)
{
- Registrations = new List
- {
+ Registrations =
+ [
new TypedRegistration(interfaceType1, implementationType, lifestyle, container),
new TypedRegistration(interfaceType2, implementationType, lifestyle, container)
- };
+ ];
}
///
@@ -97,12 +99,12 @@ internal class MultipleRegistration
- {
+ Registrations =
+ [
new TypedRegistration(interfaceType1, implementationType, lifestyle, container),
new TypedRegistration(interfaceType2, implementationType, lifestyle, container),
new TypedRegistration(interfaceType3, implementationType, lifestyle, container)
- };
+ ];
}
///
@@ -149,13 +151,13 @@ internal class MultipleRegistration
- {
+ Registrations =
+ [
new TypedRegistration(interfaceType1, implementationType, lifestyle, container),
new TypedRegistration(interfaceType2, implementationType, lifestyle, container),
new TypedRegistration(interfaceType3, implementationType, lifestyle, container),
new TypedRegistration(interfaceType4, implementationType, lifestyle, container)
- };
+ ];
}
///
@@ -206,14 +208,14 @@ internal class MultipleRegistration
- {
+ Registrations =
+ [
new TypedRegistration(interfaceType1, implementationType, lifestyle, container),
new TypedRegistration(interfaceType2, implementationType, lifestyle, container),
new TypedRegistration(interfaceType3, implementationType, lifestyle, container),
new TypedRegistration(interfaceType4, implementationType, lifestyle, container),
new TypedRegistration(interfaceType5, implementationType, lifestyle, container)
- };
+ ];
}
///
diff --git a/LightweightIocContainer/Registrations/RegistrationCollector.cs b/LightweightIocContainer/Registrations/RegistrationCollector.cs
index 1db529f..7979ef7 100644
--- a/LightweightIocContainer/Registrations/RegistrationCollector.cs
+++ b/LightweightIocContainer/Registrations/RegistrationCollector.cs
@@ -14,16 +14,12 @@ public class RegistrationCollector : IRegistrationCollector
{
private readonly RegistrationFactory _registrationFactory;
- internal RegistrationCollector(RegistrationFactory registrationFactory)
- {
- _registrationFactory = registrationFactory;
- Registrations = new List();
- }
+ internal RegistrationCollector(RegistrationFactory registrationFactory) => _registrationFactory = registrationFactory;
///
/// The collected s
///
- internal List Registrations { get; }
+ internal List Registrations { get; } = [];
///
/// Add an Interface with a Type that implements it
diff --git a/LightweightIocContainer/ResolvePlaceholders/InternalFactoryMethodPlaceholder.cs b/LightweightIocContainer/ResolvePlaceholders/InternalFactoryMethodPlaceholder.cs
index eb1c5f7..3c7c8ba 100644
--- a/LightweightIocContainer/ResolvePlaceholders/InternalFactoryMethodPlaceholder.cs
+++ b/LightweightIocContainer/ResolvePlaceholders/InternalFactoryMethodPlaceholder.cs
@@ -9,21 +9,15 @@ namespace LightweightIocContainer.ResolvePlaceholders;
///
/// An internal placeholder that is used to hold factory methods for types that need to be resolved during the resolve process
///
-internal class InternalFactoryMethodPlaceholder : IInternalToBeResolvedPlaceholder
+internal class InternalFactoryMethodPlaceholder(ISingleTypeRegistration singleTypeRegistration) : IInternalToBeResolvedPlaceholder
{
- public InternalFactoryMethodPlaceholder(ISingleTypeRegistration singleTypeRegistration)
- {
- ResolvedType = singleTypeRegistration.InterfaceType;
- SingleTypeRegistration = singleTypeRegistration;
- }
-
///
/// The to be resolved
///
- public Type ResolvedType { get; }
-
+ public Type ResolvedType { get; } = singleTypeRegistration.InterfaceType;
+
///
/// The
///
- public ISingleTypeRegistration SingleTypeRegistration { get; }
+ public ISingleTypeRegistration SingleTypeRegistration { get; } = singleTypeRegistration;
}
\ No newline at end of file
diff --git a/LightweightIocContainer/ResolvePlaceholders/InternalResolvePlaceholder.cs b/LightweightIocContainer/ResolvePlaceholders/InternalResolvePlaceholder.cs
index 15b776f..f84a6ea 100644
--- a/LightweightIocContainer/ResolvePlaceholders/InternalResolvePlaceholder.cs
+++ b/LightweightIocContainer/ResolvePlaceholders/InternalResolvePlaceholder.cs
@@ -7,7 +7,4 @@ namespace LightweightIocContainer.ResolvePlaceholders;
///
/// An internal placeholder that is used during the resolving process
///
-internal class InternalResolvePlaceholder
-{
-
-}
\ No newline at end of file
+internal class InternalResolvePlaceholder;
\ No newline at end of file
diff --git a/LightweightIocContainer/ResolvePlaceholders/InternalToBeResolvedPlaceholder.cs b/LightweightIocContainer/ResolvePlaceholders/InternalToBeResolvedPlaceholder.cs
index d8da8ca..36026be 100644
--- a/LightweightIocContainer/ResolvePlaceholders/InternalToBeResolvedPlaceholder.cs
+++ b/LightweightIocContainer/ResolvePlaceholders/InternalToBeResolvedPlaceholder.cs
@@ -9,27 +9,20 @@ namespace LightweightIocContainer.ResolvePlaceholders;
///
/// An internal placeholder that is used to hold types that need to be resolved during the resolving process
///
-internal class InternalToBeResolvedPlaceholder : IInternalToBeResolvedPlaceholder
+internal class InternalToBeResolvedPlaceholder(Type resolvedType, IRegistration resolvedRegistration, List? parameters) : IInternalToBeResolvedPlaceholder
{
- public InternalToBeResolvedPlaceholder(Type resolvedType, IRegistration resolvedRegistration, List? parameters)
- {
- ResolvedType = resolvedType;
- ResolvedRegistration = resolvedRegistration;
- Parameters = parameters;
- }
-
///
/// The to be resolved
///
- public Type ResolvedType { get; }
-
+ public Type ResolvedType { get; } = resolvedType;
+
///
/// The to be resolved
///
- public IRegistration ResolvedRegistration { get; }
-
+ public IRegistration ResolvedRegistration { get; } = resolvedRegistration;
+
///
/// The parameters needed to resolve the
///
- public List? Parameters { get; }
+ public List? Parameters { get; } = parameters;
}
\ No newline at end of file
diff --git a/Test.LightweightIocContainer.Validation/IocValidatorTest.cs b/Test.LightweightIocContainer.Validation/IocValidatorTest.cs
index 65460cc..fc48b98 100644
--- a/Test.LightweightIocContainer.Validation/IocValidatorTest.cs
+++ b/Test.LightweightIocContainer.Validation/IocValidatorTest.cs
@@ -16,10 +16,7 @@ namespace Test.LightweightIocContainer.Validation;
[TestFixture]
public class IocValidatorTest
{
- public interface ITest
- {
-
- }
+ public interface ITest;
[UsedImplicitly]
public interface IParameter
@@ -33,22 +30,13 @@ public class IocValidatorTest
}
[UsedImplicitly]
- public interface IConstraint
- {
-
- }
+ public interface IConstraint;
[UsedImplicitly]
- public interface IGenericTest where T : IConstraint, new()
- {
-
- }
+ public interface IGenericTest where T : IConstraint, new();
[UsedImplicitly]
- public class GenericTest : IGenericTest where T : IConstraint, new()
- {
-
- }
+ public class GenericTest : IGenericTest where T : IConstraint, new();
[UsedImplicitly]
public interface IGenericTestFactory
diff --git a/Test.LightweightIocContainer/AssemblyInstallerTest.cs b/Test.LightweightIocContainer/AssemblyInstallerTest.cs
index 2726cfa..f4b1f28 100644
--- a/Test.LightweightIocContainer/AssemblyInstallerTest.cs
+++ b/Test.LightweightIocContainer/AssemblyInstallerTest.cs
@@ -6,7 +6,6 @@ using System.Reflection;
using JetBrains.Annotations;
using LightweightIocContainer;
using LightweightIocContainer.Installers;
-using LightweightIocContainer.Interfaces;
using LightweightIocContainer.Interfaces.Installers;
using LightweightIocContainer.Interfaces.Registrations;
using NSubstitute;
@@ -24,20 +23,16 @@ public class AssemblyInstallerTest
}
[UsedImplicitly]
- public class AssemblyWrapper : Assembly
- {
-
- }
-
+ public class AssemblyWrapper : Assembly;
[Test]
public void TestInstall()
{
- List types = new()
- {
+ List types =
+ [
typeof(object),
typeof(TestInstaller)
- };
+ ];
AssemblyWrapper assemblyMock = Substitute.For();
assemblyMock.GetTypes().Returns(types.ToArray());
@@ -53,23 +48,23 @@ public class AssemblyInstallerTest
[Test]
public void TestFromAssemblyThis()
{
- IIocContainer iocContainer = new IocContainer();
+ IocContainer iocContainer = new();
iocContainer.Install(FromAssembly.This());
}
[Test]
public void TestFromAssemblyInstance()
{
- List types = new()
- {
+ List types =
+ [
typeof(object),
typeof(TestInstaller)
- };
+ ];
AssemblyWrapper assemblyMock = Substitute.For();
assemblyMock.GetTypes().Returns(types.ToArray());
- IIocContainer iocContainer = new IocContainer();
+ IocContainer iocContainer = new();
iocContainer.Install(FromAssembly.Instance(assemblyMock));
}
}
\ No newline at end of file
diff --git a/Test.LightweightIocContainer/EnumerableExtensionTest.cs b/Test.LightweightIocContainer/EnumerableExtensionTest.cs
index 0af47d4..4a7337f 100644
--- a/Test.LightweightIocContainer/EnumerableExtensionTest.cs
+++ b/Test.LightweightIocContainer/EnumerableExtensionTest.cs
@@ -34,20 +34,20 @@ public class EnumerableExtensionTest
[SuppressMessage("ReSharper", "CollectionNeverUpdated.Local")]
public void TestFirstOrGivenNoPredicateEmpty()
{
- List list = new();
+ List list = [];
Assert.That(list.FirstOrGiven(), Is.InstanceOf());
}
[Test]
public void TestFirstOrGivenNoPredicate()
{
- List list = new()
- {
- new ListObject {Index = 0},
- new ListObject {Index = 1},
- new ListObject {Index = 2},
- new ListObject {Index = 3}
- };
+ List list =
+ [
+ new() { Index = 0 },
+ new() { Index = 1 },
+ new() { Index = 2 },
+ new() { Index = 3 }
+ ];
ListObject listObject = list.FirstOrGiven();
@@ -59,20 +59,20 @@ public class EnumerableExtensionTest
[SuppressMessage("ReSharper", "CollectionNeverUpdated.Local")]
public void TestFirstOrGivenPredicateEmpty()
{
- List list = new();
+ List list = [];
Assert.That(list.FirstOrGiven(o => o.Index == 2), Is.InstanceOf());
}
[Test]
public void TestFirstOrGivenPredicate()
{
- List list = new()
- {
- new ListObject {Index = 0},
- new ListObject {Index = 1},
- new ListObject {Index = 2},
- new ListObject {Index = 3}
- };
+ List list =
+ [
+ new() { Index = 0 },
+ new() { Index = 1 },
+ new() { Index = 2 },
+ new() { Index = 3 }
+ ];
ListObject listObject = list.FirstOrGiven(o => o.Index == 2);
@@ -88,7 +88,7 @@ public class EnumerableExtensionTest
ITest test3 = Substitute.For();
ITest test4 = Substitute.For();
- IEnumerable enumerable = new[] { test1, test2, test3, test4 };
+ IEnumerable enumerable = [test1, test2, test3, test4];
enumerable.ForEach(t => t.DoSomething());
diff --git a/Test.LightweightIocContainer/FluentFactoryRegistrationTest.cs b/Test.LightweightIocContainer/FluentFactoryRegistrationTest.cs
index 08b5b54..566524c 100644
--- a/Test.LightweightIocContainer/FluentFactoryRegistrationTest.cs
+++ b/Test.LightweightIocContainer/FluentFactoryRegistrationTest.cs
@@ -12,15 +12,9 @@ namespace Test.LightweightIocContainer;
[TestFixture]
public class FluentFactoryRegistrationTest
{
- public interface ITest
- {
-
- }
+ public interface ITest;
- private class Test : ITest
- {
-
- }
+ private class Test : ITest;
private class TestByte : ITest
{
@@ -130,10 +124,7 @@ public class FluentFactoryRegistrationTest
public MultitonScope Create();
}
- public class MultitonScope
- {
-
- }
+ public class MultitonScope;
private IocContainer _iocContainer;
diff --git a/Test.LightweightIocContainer/IgnoreConstructorAttributeTest.cs b/Test.LightweightIocContainer/IgnoreConstructorAttributeTest.cs
index 36c5c4e..46e6d09 100644
--- a/Test.LightweightIocContainer/IgnoreConstructorAttributeTest.cs
+++ b/Test.LightweightIocContainer/IgnoreConstructorAttributeTest.cs
@@ -12,22 +12,13 @@ namespace Test.LightweightIocContainer;
public class IgnoreConstructorAttributeTest
{
[AttributeUsage(AttributeTargets.Constructor)]
- private class IgnoreAttribute : Attribute
- {
-
- }
+ private class IgnoreAttribute : Attribute;
[AttributeUsage(AttributeTargets.Class)]
- private class InvalidIgnoreAttribute : Attribute
- {
-
- }
+ private class InvalidIgnoreAttribute : Attribute;
[UsedImplicitly]
- public interface ITest
- {
-
- }
+ public interface ITest;
[UsedImplicitly]
private class TestIgnoreCtor : ITest
diff --git a/Test.LightweightIocContainer/IocContainerInterfaceSegregationTest.cs b/Test.LightweightIocContainer/IocContainerInterfaceSegregationTest.cs
index 7f5ff76..b6adda7 100644
--- a/Test.LightweightIocContainer/IocContainerInterfaceSegregationTest.cs
+++ b/Test.LightweightIocContainer/IocContainerInterfaceSegregationTest.cs
@@ -11,29 +11,17 @@ namespace Test.LightweightIocContainer;
[TestFixture]
public class IocContainerInterfaceSegregationTest
{
- private interface IBar
- {
-
- }
+ private interface IBar;
private interface IFoo
{
void ThrowFoo();
}
- private interface IAnotherBar
- {
-
- }
+ private interface IAnotherBar;
- private interface IAnotherFoo
- {
-
- }
+ private interface IAnotherFoo;
- private interface IAnotherOne
- {
-
- }
+ private interface IAnotherOne;
[UsedImplicitly]
private class Foo : IFoo, IBar, IAnotherFoo, IAnotherBar, IAnotherOne
diff --git a/Test.LightweightIocContainer/IocContainerParameterRegistrationTest.cs b/Test.LightweightIocContainer/IocContainerParameterRegistrationTest.cs
index 7505180..ad766ff 100644
--- a/Test.LightweightIocContainer/IocContainerParameterRegistrationTest.cs
+++ b/Test.LightweightIocContainer/IocContainerParameterRegistrationTest.cs
@@ -20,16 +20,10 @@ public class IocContainerParameterRegistrationTest
}
[UsedImplicitly]
- public interface IB
- {
-
- }
+ public interface IB;
[UsedImplicitly]
- public interface IC
- {
-
- }
+ public interface IC;
[UsedImplicitly]
public interface ID
@@ -64,10 +58,7 @@ public class IocContainerParameterRegistrationTest
}
[UsedImplicitly]
- private class C : IC
- {
-
- }
+ private class C : IC;
[UsedImplicitly]
private class D : ID
@@ -87,7 +78,6 @@ public class IocContainerParameterRegistrationTest
public IB B { get; }
public IC C { get; }
}
-
private IocContainer _iocContainer;
@@ -97,7 +87,6 @@ public class IocContainerParameterRegistrationTest
[TearDown]
public void TearDown() => _iocContainer.Dispose();
-
[Test]
public void TestResolveOnlyRegistrationParameters()
{
diff --git a/Test.LightweightIocContainer/IocContainerRecursionTest.cs b/Test.LightweightIocContainer/IocContainerRecursionTest.cs
index 42373e1..ad9c956 100644
--- a/Test.LightweightIocContainer/IocContainerRecursionTest.cs
+++ b/Test.LightweightIocContainer/IocContainerRecursionTest.cs
@@ -14,16 +14,10 @@ namespace Test.LightweightIocContainer;
public class IocContainerRecursionTest
{
[UsedImplicitly]
- public interface IFoo
- {
-
- }
+ public interface IFoo;
[UsedImplicitly]
- public interface IBar
- {
-
- }
+ public interface IBar;
[UsedImplicitly]
private class Foo : IFoo
@@ -42,22 +36,13 @@ public class IocContainerRecursionTest
}
[UsedImplicitly]
- public interface IA
- {
-
- }
+ public interface IA;
[UsedImplicitly]
- public interface IB
- {
-
- }
+ public interface IB;
[UsedImplicitly]
- public interface IC
- {
-
- }
+ public interface IC;
[UsedImplicitly]
private class A : IA
@@ -78,10 +63,7 @@ public class IocContainerRecursionTest
}
[UsedImplicitly]
- private class C : IC
- {
-
- }
+ private class C : IC;
[UsedImplicitly]
private class ATwoCtor : IA
diff --git a/Test.LightweightIocContainer/IocContainerTest.cs b/Test.LightweightIocContainer/IocContainerTest.cs
index b15522e..72a0044 100644
--- a/Test.LightweightIocContainer/IocContainerTest.cs
+++ b/Test.LightweightIocContainer/IocContainerTest.cs
@@ -12,20 +12,11 @@ namespace Test.LightweightIocContainer;
[TestFixture]
public class IocContainerTest
{
- private interface ITest
- {
-
- }
-
- private interface IFoo
- {
+ private interface ITest;
- }
-
- private class Test : ITest
- {
+ private interface IFoo;
- }
+ private class Test : ITest;
private class TestMultiton : ITest
{
@@ -35,10 +26,7 @@ public class IocContainerTest
}
}
- private class TestMultitonIntScope(int scope) : ITest
- {
-
- }
+ private class TestMultitonIntScope(int scope) : ITest;
[UsedImplicitly]
private class TestConstructor : ITest
@@ -92,10 +80,7 @@ public class IocContainerTest
}
[UsedImplicitly]
- private class Foo : IFoo
- {
-
- }
+ private class Foo : IFoo;
[UsedImplicitly]
private class FooConstructor : IFoo
@@ -106,11 +91,7 @@ public class IocContainerTest
}
}
- private class MultitonScope
- {
-
- }
-
+ private class MultitonScope;
private IocContainer _iocContainer;
@@ -120,7 +101,6 @@ public class IocContainerTest
[TearDown]
public void TearDown() => _iocContainer.Dispose();
-
[Test]
public void TestInstall()
{
diff --git a/Test.LightweightIocContainer/MultipleMultitonRegistrationTest.cs b/Test.LightweightIocContainer/MultipleMultitonRegistrationTest.cs
index 20254ee..67e9557 100644
--- a/Test.LightweightIocContainer/MultipleMultitonRegistrationTest.cs
+++ b/Test.LightweightIocContainer/MultipleMultitonRegistrationTest.cs
@@ -14,10 +14,7 @@ public class MultipleMultitonRegistrationTest
private IocContainer _iocContainer;
[UsedImplicitly]
- public interface ITest : IProvider
- {
-
- }
+ public interface ITest : IProvider;
public interface IProvider
{
@@ -38,11 +35,7 @@ public class MultipleMultitonRegistrationTest
public void DoSomething(int number) => Number = number;
}
- private class MultitonScope
- {
-
- }
-
+ private class MultitonScope;
[SetUp]
public void SetUp() => _iocContainer = new IocContainer();
diff --git a/Test.LightweightIocContainer/OnCreateTest.cs b/Test.LightweightIocContainer/OnCreateTest.cs
index 4fad5b3..8f58412 100644
--- a/Test.LightweightIocContainer/OnCreateTest.cs
+++ b/Test.LightweightIocContainer/OnCreateTest.cs
@@ -23,7 +23,6 @@ public class OnCreateTest
public void DoSomething() => throw new Exception();
public Task InitializeAsync() => throw new Exception();
}
-
[Test]
public void TestOnCreate()
diff --git a/Test.LightweightIocContainer/OpenGenericRegistrationTest.cs b/Test.LightweightIocContainer/OpenGenericRegistrationTest.cs
index 67e7be4..3985b61 100644
--- a/Test.LightweightIocContainer/OpenGenericRegistrationTest.cs
+++ b/Test.LightweightIocContainer/OpenGenericRegistrationTest.cs
@@ -16,29 +16,17 @@ public class OpenGenericRegistrationTest
private IocContainer _iocContainer;
[UsedImplicitly]
- public interface IConstraint
- {
-
- }
+ public interface IConstraint;
[UsedImplicitly]
- public class Constraint : IConstraint
- {
-
- }
+ public class Constraint : IConstraint;
[UsedImplicitly]
[SuppressMessage("ReSharper", "UnusedTypeParameter")]
- public interface ITest where T : IConstraint, new()
- {
-
- }
+ public interface ITest where T : IConstraint, new();
[UsedImplicitly]
- public class Test : ITest where T : IConstraint, new()
- {
-
- }
+ public class Test : ITest where T : IConstraint, new();
[UsedImplicitly]
public class CtorTest : ITest where T : IConstraint, new()
diff --git a/Test.LightweightIocContainer/RegistrationBaseTest.cs b/Test.LightweightIocContainer/RegistrationBaseTest.cs
index 5038785..0d9db63 100644
--- a/Test.LightweightIocContainer/RegistrationBaseTest.cs
+++ b/Test.LightweightIocContainer/RegistrationBaseTest.cs
@@ -15,25 +15,13 @@ namespace Test.LightweightIocContainer;
[TestFixture]
public class RegistrationBaseTest
{
- private interface ITest
- {
-
- }
-
- private interface IFoo
- {
-
- }
-
- private interface IBar
- {
+ private interface ITest;
- }
+ private interface IFoo;
- private class Test : ITest
- {
+ private interface IBar;
- }
+ private class Test : ITest;
[UsedImplicitly]
private class Foo : IFoo
@@ -44,11 +32,7 @@ public class RegistrationBaseTest
}
}
- private class Bar : IBar
- {
-
- }
-
+ private class Bar : IBar;
[Test]
public void TestWithParameters()
diff --git a/Test.LightweightIocContainer/SingleTypeRegistrationTest.cs b/Test.LightweightIocContainer/SingleTypeRegistrationTest.cs
index 1ecea63..e014bd2 100644
--- a/Test.LightweightIocContainer/SingleTypeRegistrationTest.cs
+++ b/Test.LightweightIocContainer/SingleTypeRegistrationTest.cs
@@ -27,10 +27,7 @@ public class SingleTypeRegistrationTest
}
[UsedImplicitly]
- public interface IBar
- {
-
- }
+ public interface IBar;
[UsedImplicitly]
private class Foo : IFoo
@@ -41,10 +38,7 @@ public class SingleTypeRegistrationTest
}
[UsedImplicitly]
- private class Bar : IBar
- {
-
- }
+ private class Bar : IBar;
[Test]
public void TestSingleTypeRegistrationWithFactoryMethod()