Class Singleton<T>.Temp
Structure which used for temporary replaced singletons (for test purposes). It saves previous singleton object (usually null) and when disposed restores it. It may be preferred over WithTempSingleton<TNew>(Action), because you may create this object in [SetUp] method and destroy in [TearDown] method allowing all tests to run with this temp singleton without explicitly wrapping them in WithTempSingleton call.
Inheritance
System.Object
Singleton<T>.Temp
Implements
System.IDisposable
Namespace: Eco.Shared.Utils
Assembly: Eco.Shared.dll
Syntax
public sealed class Temp : ValueType, IDisposable
Methods
Create(Func<T>)
Declaration
public static Singleton<T>.Temp Create(Func<T> factory)
Parameters
Type | Name | Description |
---|---|---|
System.Func<T> | factory |
Returns
Type | Description |
---|---|
Singleton.Temp<> |
Create<TNew>()
Declaration
public static Singleton<T>.Temp Create<TNew>()
where TNew : T, new()
Returns
Type | Description |
---|---|
Singleton.Temp<> |
Type Parameters
Name | Description |
---|---|
TNew |
Dispose()
Declaration
public void Dispose()
Implements
System.IDisposable