public static IBoltProtocol ForVersion(BoltProtocolVersion version, IDictionary <string, string> routingContext = null) { if (version.Equals(3, 0)) { return(new BoltProtocolV3()); } else if (version.Equals(4, 0)) { return(new BoltProtocolV4()); } else if (version.Equals(4, 1)) { return(new BoltProtocolV4_1(routingContext)); } else if (version.Equals(0, 0)) { throw new NotSupportedException( "The Neo4j server does not support any of the protocol versions supported by this client. " + "Ensure that you are using driver and server versions that are compatible with one another."); } else if (version == new BoltProtocolVersion(BoltHTTPIdentifier)) { throw new NotSupportedException( "Server responded HTTP. Make sure you are not trying to connect to the http endpoint " + $"(HTTP defaults to port 7474 whereas BOLT defaults to port {GraphDatabase.DefaultBoltPort})"); } else { throw new NotSupportedException( "Protocol error, server suggested unexpected protocol version: " + version.MajorVersion + "." + version.MinorVersion); } }
public void EqualsSuccess() { var v1 = new BoltProtocolVersion(1, 1); var v2 = new BoltProtocolVersion(1, 1); (v1.Equals(v2)).Should().BeTrue(); v2 = new BoltProtocolVersion(1, 3); (v1.Equals(v2)).Should().BeFalse(); (v1.Equals(null)).Should().BeFalse(); }