feature/edit/subset (#283)

* Changing query/subset API to only use Result on success, Error on error

* Creating an interservice API for getting query result subsets

* Updates to subset API

* RowStartIndex is now long
* Output of query/subset is a 2D array of DbCellValue
* Adding LongSkip method to LongList to allow skipping ahead by longs
* Moving LongList back to ServiceLayer utilities. Move refactoring

* Stubbing out request for edit/subset

* Initial implementation of getting edit rows

* Unit tests for RowEdit and RowDelete .GetEditRow

* Fixing major bugs in LongList implementation, adding much more thorough tests

* Adding some more unit tests and fixes to make unit tests pass

* Fixing comment
This commit is contained in:
Benjamin Russell
2017-03-21 15:14:04 -07:00
committed by GitHub
parent 9e576dea92
commit d7ecfb1a87
26 changed files with 1165 additions and 165 deletions

View File

@@ -64,6 +64,8 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData
efv.Validate();
}
#endregion
#region Dispose Tests
@@ -215,6 +217,36 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.EditData
edit.Verify(e => e.SetCell(It.IsAny<int>(), It.IsAny<string>()), Times.Once);
}
[Fact]
public async Task GetRowsSuccess()
{
// Setup: Create an edit data service with a session
// Setup: Create an edit data service with a session
var eds = new EditDataService(null, null, null);
var session = GetDefaultSession();
eds.ActiveSessions[Constants.OwnerUri] = session;
// If: I validly ask for rows
var efv = new EventFlowValidator<EditSubsetResult>()
.AddResultValidation(esr =>
{
Assert.NotNull(esr);
Assert.NotEmpty(esr.Subset);
Assert.NotEqual(0, esr.RowCount);
})
.Complete();
await eds.HandleSubsetRequest(new EditSubsetParams
{
OwnerUri = Constants.OwnerUri,
RowCount = 10,
RowStartIndex = 0
}, efv.Object);
// Then:
// ... It should be successful
efv.Validate();
}
[Theory]
[InlineData(null, "table", "table")] // Null owner URI
[InlineData(Common.OwnerUri, null, "table")] // Null object name