Skip to content

Commit

Permalink
Fixing some minor naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhen Li committed Jul 4, 2017
1 parent fa711ef commit e88daf6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void ShouldStreamResults()
{
var builder = GenerateBuilder();
var i = 0;
builder.SetReceiveOneAction(() =>
builder.SetReceiveOneFunc(() =>
{
if (i++ >= 3)
{
Expand All @@ -86,7 +86,7 @@ public void ShouldStreamResults()
public void ShouldReturnNoResultsWhenNoneRecieved()
{
var builder = GenerateBuilder();
builder.SetReceiveOneAction(() =>
builder.SetReceiveOneFunc(() =>
{
builder.CollectSummary(null);
Expand Down Expand Up @@ -130,7 +130,7 @@ public void ShouldStopStreamingWhenResultIsInvalid()
{
var builder = GenerateBuilder();
var i = 0;
builder.SetReceiveOneAction(() =>
builder.SetReceiveOneFunc(() =>
{
if (i++ >= 3)
{
Expand Down
24 changes: 0 additions & 24 deletions Neo4j.Driver/Neo4j.Driver.Tests/SessionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,30 +244,6 @@ public void ShouldDisposeConnectionOnNewBeginTxIfBeginTxFailed()

public class BeginTransactionAsyncMethod
{

[Fact]
public async void ShouldIgnoreNullBookmark()
{
var mockConn = new Mock<IConnection>();
mockConn.Setup(x => x.IsOpen).Returns(true);
var session = NewSession(mockConn.Object, bookmark: FakeABookmark(123));
session.LastBookmark.Should().EndWith("123");
await session.BeginTransactionAsync(null);
session.LastBookmark.Should().EndWith("123");
}

[Fact]
public async void ShouldSetNewBookmark()
{
var mockConn = new Mock<IConnection>();
mockConn.Setup(x => x.IsOpen).Returns(true);
var session = NewSession(mockConn.Object, bookmark: FakeABookmark(123));
session.LastBookmark.Should().EndWith("123");
// begin tx will directly override the bookmark that was originally set before
await session.BeginTransactionAsync(FakeABookmark(12));
session.LastBookmark.Should().EndWith("12");
}

[Fact]
public async void ShouldNotAllowNewTxWhileOneIsRunning()
{
Expand Down
10 changes: 5 additions & 5 deletions Neo4j.Driver/Neo4j.Driver/Internal/Result/ResultReaderBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public ResultReaderBuilder() : this(null, null, null, null, null)
{
}

public ResultReaderBuilder(Statement statement, Func<Task> receiveOneAction, IServerInfo server, IResultResourceHandler resourceHandler = null)
public ResultReaderBuilder(Statement statement, Func<Task> receiveOneFunc, IServerInfo server, IResultResourceHandler resourceHandler = null)
: base(statement, server, resourceHandler)
{
SetReceiveOneAction(receiveOneAction);
SetReceiveOneFunc(receiveOneFunc);
}

public ResultReaderBuilder(string statement, IDictionary<string, object> parameters,
Expand All @@ -47,7 +47,7 @@ public ResultReaderBuilder(Statement statement, Func<Task> receiveOneAction, ISe

public IStatementResultReader PreBuild()
{
return new StatementResultReader(_keys, NextRecord, SummaryAsync);
return new StatementResultReader(_keys, NextRecordAsync, SummaryAsync);
}

/// <summary>
Expand All @@ -69,7 +69,7 @@ private async Task<IResultSummary> SummaryAsync()
/// Return next record in the record stream if any, otherwise return null
/// </summary>
/// <returns>Next record in the record stream if any, otherwise return null</returns>
private async Task<IRecord> NextRecord()
private async Task<IRecord> NextRecordAsync()
{
if (_records.Count > 0)
{
Expand All @@ -82,7 +82,7 @@ private async Task<IRecord> NextRecord()
return _records.Count > 0 ? _records.Dequeue() : null;
}

internal void SetReceiveOneAction(Func<Task> receiveOneAction)
internal void SetReceiveOneFunc(Func<Task> receiveOneAction)
{
_receiveOneFunc = async () =>
{
Expand Down
8 changes: 0 additions & 8 deletions Neo4j.Driver/Neo4j.Driver/Internal/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Neo4j.Driver.Internal.Connector;
using Neo4j.Driver.Internal.Result;
Expand Down Expand Up @@ -427,13 +426,6 @@ public Task<ITransactionAsync> BeginTransactionAsync()
return TryExecuteAsync(async()=> await BeginTransactionWithoutLoggingAsync(_defaultMode));
}

public Task<ITransactionAsync> BeginTransactionAsync(string bookmark)
{
UpdateBookmark(Bookmark.From(bookmark, _logger));

return BeginTransactionAsync();
}

private Task RunTransactionAsync(AccessMode mode, Func<ITransactionAsync, Task> work)
{
return RunTransactionAsync(mode, async tx =>
Expand Down

0 comments on commit e88daf6

Please sign in to comment.