Show / Hide Table of Contents

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

Extension Methods

CommandLine.FeedFromCommandLine(Object)
CommandLine.ToCommandLineArgs(Object, Func<Object, Boolean>)
ListUtil.DepthFirstTraversal<T>(T, Func<T, IEnumerable<T>>)
EnumerableExtensions.SingleItemAsEnumerable<T>(T)
EventUtils.RaiseEvent<TEventArgs>(Object, String, TEventArgs)
PredicateUtils.MatchesAll<TEnumerable, T>(T, TEnumerable)
PredicateUtils.MatchesAll<T>(T, Func<T, Boolean>[])
PredicateUtils.MatchesAny<TEnumerable, T>(T, TEnumerable)
ReflectionUtils.PropertyValue<T>(Object, PropertyInfo)
ReflectionUtils.TryGetPropertyValueByName<T>(Object, String, out T)
ReflectionUtils.GetPropertyValueByName<T>(Object, String)
ReflectionUtils.SetPropertyByName(Object, String, Object)
ReflectionUtils.GetStructPropertyByName<T>(Object, String)
ReflectionUtils.GetStringPropertyByName(Object, String)
ReflectionUtils.ZipByProperty<T>(Object, Object, Object, Func<T, T, T>)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾