public void CreateFactory_returns_null_for_null_type([Frozen] IInstanceCreator creator, WebDriverFactoryCreator sut) { // Arrange Mock.Get(creator).Setup(x => x.CreateInstance(It.IsAny <Type>())).Returns((object)null); // Act var result = sut.GetFactory(null); // Assert Assert.That(result, Is.Null); }
public void CreateFactory_calls_instance_creator_using_correct_type([Frozen] IInstanceCreator creator, WebDriverFactoryCreator sut) { // Arrange var typeName = typeof(FactoryType).AssemblyQualifiedName; // Act sut.GetFactory(typeName); // Assert Mock.Get(creator).Verify(x => x.CreateInstance(typeof(FactoryType)), Times.Once); }
public void CreateFactory_returns_result_from_instance_creator([Frozen] IInstanceCreator creator, WebDriverFactoryCreator sut, ICreatesWebDriver expectedResult) { // Arrange var typeName = typeof(FactoryType).AssemblyQualifiedName; Mock.Get(creator).Setup(x => x.CreateInstance(typeof(FactoryType))).Returns(expectedResult); // Act var result = sut.GetFactory(typeName); // Assert Assert.That(result, Is.SameAs(expectedResult)); }