public void CanCreateAndOpenConnection_passes_the_latest_EF_version_as_the_max_version() { var mockEntityConnection = new Mock <EntityConnection>(); var mockConnectionFactory = new Mock <StoreSchemaConnectionFactory>(); Version version; mockConnectionFactory .Setup( f => f.Create( It.IsAny <IDbDependencyResolver>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Version>(), out version)) .Returns(mockEntityConnection.Object); ModelBuilderEngine.CanCreateAndOpenConnection( mockConnectionFactory.Object, "fakeInvariantName", "fakeInvariantName", "fakeConnectionString"); mockConnectionFactory.Verify( f => f.Create( It.IsAny <IDbDependencyResolver>(), It.Is <string>(s => s == "fakeInvariantName"), It.Is <string>(s => s == "fakeConnectionString"), It.Is <Version>(v => v == EntityFrameworkVersion.Latest), out version), Times.Once()); }
public void CanCreateAndOpenConnection_returns_true_for_valid_connection() { var mockEntityConnection = new Mock <EntityConnection>(); var mockConnectionFactory = new Mock <StoreSchemaConnectionFactory>(); Version version; mockConnectionFactory .Setup( f => f.Create( It.IsAny <IDbDependencyResolver>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Version>(), out version)) .Returns(mockEntityConnection.Object); Assert.True( ModelBuilderEngine.CanCreateAndOpenConnection( mockConnectionFactory.Object, "fakeInvariantName", "fakeInvariantName", "fakeConnectionString")); }