public void GetInstance_ShouldConstructNewInstance() { // Arrange var type = typeof(string); var instance = "hello"; var mockFactory = new Mock <IFactory>(MockBehavior.Strict); mockFactory .Setup(f => f.ConstructNewInstance()) .Returns(instance); var subject = new TransientLifetime(type, mockFactory.Object); // Act var result = subject.GetInstance(); // Assert result.ShouldBe(instance); mockFactory.VerifyAll(); }