public async Task SkipsOverExtraFieldsInDbmsComponents() { const string uri = "bolt://localhost"; var record1Mock = new Mock <IRecord>(); record1Mock.Setup(r => r["name"]).Returns("another-value"); var record2Mock = new Mock <IRecord>(); record2Mock.Setup(r => r["name"]).Returns("neo4j kernel"); record2Mock.Setup(r => r["versions"]).Returns(new List <object> { "3.2.3" }); var testSr = new TestStatementResult(new[] { record1Mock.Object, record2Mock.Object }); var sessionMock = new Mock <IAsyncSession>(); sessionMock .Setup(s => s.RunAsync("CALL dbms.components()")) .Returns(Task.FromResult <IResultCursor>(testSr)); var driverMock = new Mock <IDriver>(); driverMock.Setup(d => d.AsyncSession(It.IsAny <Action <SessionConfigBuilder> >())).Returns(sessionMock.Object); var bgc = new BoltGraphClient(driverMock.Object); await bgc.ConnectAsync(); bgc.ServerVersion.Should().Be(new Version(3, 2, 3)); }
public static Mock <IDriver> MockDriverWithConnectionSet() { const string uri = "bolt://localhost"; var recordMock = new Mock <IRecord>(); recordMock.Setup(r => r["name"]).Returns("neo4j kernel"); recordMock.Setup(r => r["versions"]).Returns(new List <object> { "3.2.3" }); var testSr = new TestStatementResult(new[] { recordMock.Object }); var sessionMock = new Mock <IAsyncSession>(); sessionMock .Setup(s => s.RunAsync("CALL dbms.components()")) .Returns(Task.FromResult <IResultCursor>(testSr)); var driverMock = new Mock <IDriver>(); driverMock.Setup(d => d.AsyncSession(It.IsAny <Action <SessionConfigBuilder> >())).Returns(sessionMock.Object); driverMock.Setup(d => d.AsyncSession()).Returns(sessionMock.Object); //driverMock.Setup(d => d.Uri).Returns(new Uri(uri)); return(driverMock); }