static void Main(string[] args) { ConsoleTraceListener listener = new ConsoleTraceListener(); Trace.Listeners.Add(listener); SampleClass sampleClass = new SampleClass(); DumpAssemblies(); Trace.Write("Press any key to exit"); Console.ReadKey(); Trace.Listeners.Remove(listener); }
/// <summary> /// An extension action. /// </summary> /// <param name="sample">The instance.</param> /// <param name="arg1">1st argument.</param> /// <param name="arg2">2nd argument.</param> /// <returns>A return value.</returns> public static bool ExtensionFunc(this SampleClass sample, bool arg1, DateTime arg2) { return(default);
/// <summary> /// An extension action. /// </summary> /// <param name="sample">The instance.</param> /// <param name="arg1">1st argument.</param> /// <param name="arg2">2nd argument.</param> public static void ExtensionAction(this SampleClass sample, bool arg1, DateTime arg2) { }
public void ShouldSetPropertyValue() { var targetType = typeof(SampleClassWithInjectionProperties); var targetProperty = targetType.GetProperty("SomeProperty"); Assert.IsNotNull(targetProperty); // Configure the target var instance = new SampleClassWithInjectionProperties(); // This is the service that should be assigned // to the SomeProperty property object service = new SampleClass(); // Initialize the container var container = new ServiceContainer(); container.LoadFrom(AppDomain.CurrentDomain.BaseDirectory, "LinFu*.dll"); IPropertySetter setter = container.GetService<IPropertySetter>(); Assert.IsNotNull(setter); setter.Set(instance, targetProperty, service); Assert.IsNotNull(instance.SomeProperty); Assert.AreSame(service, instance.SomeProperty); }
/// <summary> /// A static action. /// </summary> /// <param name="sample">sample instance.</param> public static void StaticAction(SampleClass sample) { }