Skip to content

Commit c5f4863

Browse files
committed
Add descriptions to SqlBufferTests
1 parent 996e460 commit c5f4863

File tree

1 file changed

+42
-0
lines changed
  • src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient

1 file changed

+42
-0
lines changed

src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/SqlBufferTests.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,22 @@
88

99
namespace Microsoft.Data.SqlClient.UnitTests
1010
{
11+
/// <summary>
12+
/// Tests that null and non-null values assigned to the SqlBuffer round-trip correctly to their CLR and their
13+
/// their SqlTypes representations.
14+
/// </summary>
15+
/// <remarks>
16+
/// Several methods in this class are internal. This is because their parameters are of SqlBuffer.StorageType,
17+
/// which is non-public.
18+
/// </remarks>
1119
public sealed class SqlBufferTests
1220
{
1321
private readonly SqlBuffer _target = new();
1422

23+
/// <summary>
24+
/// Verifies that if a SqlBuffer is directly assigned the value of SqlGuid.Null, accessing its Guid property
25+
/// throws a SqlNullValueException.
26+
/// </summary>
1527
[Fact]
1628
public void GuidShouldThrowWhenSqlGuidNullIsSet()
1729
{
@@ -20,6 +32,10 @@ public void GuidShouldThrowWhenSqlGuidNullIsSet()
2032
Assert.Throws<SqlNullValueException>(() => _target.Guid);
2133
}
2234

35+
/// <summary>
36+
/// Verifies that if a SqlBuffer is set to null of type Guid or SqlGuid, accessing its Guid property throws
37+
/// a SqlNullValueException.
38+
/// </summary>
2339
[Theory]
2440
[InlineData(SqlBuffer.StorageType.Guid)]
2541
[InlineData(SqlBuffer.StorageType.SqlGuid)]
@@ -30,6 +46,9 @@ internal void GuidShouldThrowWhenSetToNullOfTypeIsCalled(SqlBuffer.StorageType s
3046
Assert.Throws<SqlNullValueException>(() => _target.Guid);
3147
}
3248

49+
/// <summary>
50+
/// Verifies that the Guid property round-trips correctly.
51+
/// </summary>
3352
[Fact]
3453
public void GuidShouldReturnWhenGuidIsSet()
3554
{
@@ -39,6 +58,9 @@ public void GuidShouldReturnWhenGuidIsSet()
3958
Assert.Equal(expected, _target.Guid);
4059
}
4160

61+
/// <summary>
62+
/// Verifies that the SqlGuid property round-trips to the Guid property correctly.
63+
/// </summary>
4264
[Fact]
4365
public void GuidShouldReturnExpectedWhenSqlGuidIsSet()
4466
{
@@ -48,6 +70,10 @@ public void GuidShouldReturnExpectedWhenSqlGuidIsSet()
4870
Assert.Equal(expected, _target.Guid);
4971
}
5072

73+
/// <summary>
74+
/// Verifies that if a SqlBuffer is set to null of type Guid or SqlGuid, accessing its SqlGuid property returns
75+
/// SqlGuid.Null.
76+
/// </summary>
5177
[Theory]
5278
[InlineData(SqlBuffer.StorageType.Guid)]
5379
[InlineData(SqlBuffer.StorageType.SqlGuid)]
@@ -58,6 +84,10 @@ internal void SqlGuidShouldReturnSqlNullWhenSetToNullOfTypeIsCalled(SqlBuffer.St
5884
Assert.Equal(SqlGuid.Null, _target.SqlGuid);
5985
}
6086

87+
/// <summary>
88+
/// Verifies that if a SqlBuffer is directly assigned the value of SqlGuid.Null, accessing its SqlGuid property
89+
/// returns SqlGuid.Null.
90+
/// </summary>
6191
[Fact]
6292
public void SqlGuidShouldReturnSqlGuidNullWhenSqlGuidNullIsSet()
6393
{
@@ -66,6 +96,9 @@ public void SqlGuidShouldReturnSqlGuidNullWhenSqlGuidNullIsSet()
6696
Assert.Equal(SqlGuid.Null, _target.SqlGuid);
6797
}
6898

99+
/// <summary>
100+
/// Verifies that the Guid property round-trips to the SqlGuid property correctly.
101+
/// </summary>
69102
[Fact]
70103
public void SqlGuidShouldReturnExpectedWhenGuidIsSet()
71104
{
@@ -76,6 +109,9 @@ public void SqlGuidShouldReturnExpectedWhenGuidIsSet()
76109
Assert.Equal(expected, _target.SqlGuid);
77110
}
78111

112+
/// <summary>
113+
/// Verifies that the SqlGuid property round-trips correctly.
114+
/// </summary>
79115
[Fact]
80116
public void SqlGuidShouldReturnExpectedWhenSqlGuidIsSet()
81117
{
@@ -85,6 +121,9 @@ public void SqlGuidShouldReturnExpectedWhenSqlGuidIsSet()
85121
Assert.Equal(expected, _target.SqlGuid);
86122
}
87123

124+
/// <summary>
125+
/// Verifies that the Guid property round-trips to the SqlValue property correctly.
126+
/// </summary>
88127
[Fact]
89128
public void SqlValueShouldReturnExpectedWhenGuidIsSet()
90129
{
@@ -95,6 +134,9 @@ public void SqlValueShouldReturnExpectedWhenGuidIsSet()
95134
Assert.Equal(expected, _target.SqlValue);
96135
}
97136

137+
/// <summary>
138+
/// Verifies that the SqlGuid property round-trips to the SqlValue property correctly.
139+
/// </summary>
98140
[Fact]
99141
public void SqlValueShouldReturnExpectedWhenSqlGuidIsSet()
100142
{

0 commit comments

Comments
 (0)