public void RegisterSingletonObject() { ObjectContainer locator = new ObjectContainer(); locator.RegisterSingleton<object>(c => { return new object(); }); var result = locator.Create<object>(); Assert.IsAssignableFrom<object>(result); var result2 = locator.Create<object>(); Assert.AreSame(result, result2); }
public void ToString_NoParameters_ReturnsDescription() { ObjectContainer locator = new ObjectContainer(); locator.RegisterSingleton<object>(c => { return new object(); }); var log = new Mock<ILogger>(); locator.Register<ILogger>(c => { return log.Object; }); locator.Configuration["Object"]=new object(); var result = locator.ToString(); Assert.IsInstanceOf<string>(result); //Console.WriteLine(result); }