public void ContainerDebugView_CustomLifestyleDependingOnLongerThanTransient_ResultsInWarning() { // Arrange var container = new Container(); var longerThanTransientLifestyle = new FakeLifestyle(length: 100); container.Register <IUserRepository, InMemoryUserRepository>(longerThanTransientLifestyle); container.Register <UserServiceBase, FakeUserService>(CustomLifestyle); // Act var items = VerifyAndGetDebuggerViewItems(container); // Assert Assert_HasPotentialLifestyleMismatch(items); }
public void ContainerDebugView_LongerThanTransientDependingOnCustomLifestyle_ResultsInWarning() { // Arrange var container = new Container(); var longerThanTransientLifestyle = new FakeLifestyle(length: 100); container.Register <IUserRepository, InMemoryUserRepository>(Lifestyle.Singleton); // It should produce a warning because we don't know what the exact lifetime of the custom is, // so if it's not transient, there could potentially be a problem. container.Register <UserServiceBase, FakeUserService>(CustomLifestyle); container.Register <UserController, UserController>(longerThanTransientLifestyle); // Act var items = VerifyAndGetDebuggerViewItems(container); // Assert Assert_HasPotentialLifestyleMismatch(items); }