Fix: GUIDs not being stored as Guids (#461)

* Fixing issue where Guids weren't being stored in the service buffer file as Guids

* Removing unnecessary ReadSqlGuid method

* Adding unit test for revert cell integration

* Adding unit test for edit session initialization

* Revert "Adding unit test for revert cell integration"

This reverts commit a949926f2ebbb0c39f776edba76d999af4f3f3e9.

* Revert "Adding unit test for edit session initialization"

This reverts commit ff9e5a7d0e5392b27257e57db64879699d73d21c.
This commit is contained in:
Benjamin Russell
2017-09-20 09:59:25 -07:00
committed by GitHub
parent a35cd8ed2b
commit 5cf779fd23
3 changed files with 19 additions and 15 deletions

View File

@@ -19,7 +19,7 @@ using Xunit;
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.DataStorage
{
public class ReaderWriterPairTest
public class ServiceBufferReaderWriterTests
{
[Fact]
public void ReaderStreamNull()
@@ -535,23 +535,25 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.DataStorage
(reader, rowId) => reader.ReadBytes(0, rowId));
}
[Fact]
public void GuidTest()
public static IEnumerable<object[]> GuidTestParameters
{
// Setup:
// ... Create some test values
// NOTE: We are doing these here instead of InlineData because Guid type can't be written as constant expressions
Guid[] guids =
get
{
Guid.Empty, Guid.NewGuid(), Guid.NewGuid()
};
foreach (Guid guid in guids)
{
VerifyReadWrite(guid.ToByteArray().Length + 1, new SqlGuid(guid), (writer, val) => writer.WriteGuid(guid),
(reader, rowId) => reader.ReadGuid(0, rowId));
yield return new object[] {Guid.Empty};
yield return new object[] {Guid.NewGuid()};
yield return new object[] {Guid.NewGuid()};
}
}
[Theory]
[MemberData(nameof(GuidTestParameters))]
public void GuidTest(Guid testValue)
{
VerifyReadWrite(testValue.ToByteArray().Length + 1, testValue,
(writer, val) => writer.WriteGuid(testValue),
(reader, rowId) => reader.ReadGuid(0, rowId));
}
[Fact]
public void MoneyTest()
{