8
8
9
9
namespace Microsoft . Data . SqlClient . UnitTests
10
10
{
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>
11
19
public sealed class SqlBufferTests
12
20
{
13
21
private readonly SqlBuffer _target = new ( ) ;
14
22
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>
15
27
[ Fact ]
16
28
public void GuidShouldThrowWhenSqlGuidNullIsSet ( )
17
29
{
@@ -20,6 +32,10 @@ public void GuidShouldThrowWhenSqlGuidNullIsSet()
20
32
Assert . Throws < SqlNullValueException > ( ( ) => _target . Guid ) ;
21
33
}
22
34
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>
23
39
[ Theory ]
24
40
[ InlineData ( SqlBuffer . StorageType . Guid ) ]
25
41
[ InlineData ( SqlBuffer . StorageType . SqlGuid ) ]
@@ -30,6 +46,9 @@ internal void GuidShouldThrowWhenSetToNullOfTypeIsCalled(SqlBuffer.StorageType s
30
46
Assert . Throws < SqlNullValueException > ( ( ) => _target . Guid ) ;
31
47
}
32
48
49
+ /// <summary>
50
+ /// Verifies that the Guid property round-trips correctly.
51
+ /// </summary>
33
52
[ Fact ]
34
53
public void GuidShouldReturnWhenGuidIsSet ( )
35
54
{
@@ -39,6 +58,9 @@ public void GuidShouldReturnWhenGuidIsSet()
39
58
Assert . Equal ( expected , _target . Guid ) ;
40
59
}
41
60
61
+ /// <summary>
62
+ /// Verifies that the SqlGuid property round-trips to the Guid property correctly.
63
+ /// </summary>
42
64
[ Fact ]
43
65
public void GuidShouldReturnExpectedWhenSqlGuidIsSet ( )
44
66
{
@@ -48,6 +70,10 @@ public void GuidShouldReturnExpectedWhenSqlGuidIsSet()
48
70
Assert . Equal ( expected , _target . Guid ) ;
49
71
}
50
72
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>
51
77
[ Theory ]
52
78
[ InlineData ( SqlBuffer . StorageType . Guid ) ]
53
79
[ InlineData ( SqlBuffer . StorageType . SqlGuid ) ]
@@ -58,6 +84,10 @@ internal void SqlGuidShouldReturnSqlNullWhenSetToNullOfTypeIsCalled(SqlBuffer.St
58
84
Assert . Equal ( SqlGuid . Null , _target . SqlGuid ) ;
59
85
}
60
86
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>
61
91
[ Fact ]
62
92
public void SqlGuidShouldReturnSqlGuidNullWhenSqlGuidNullIsSet ( )
63
93
{
@@ -66,6 +96,9 @@ public void SqlGuidShouldReturnSqlGuidNullWhenSqlGuidNullIsSet()
66
96
Assert . Equal ( SqlGuid . Null , _target . SqlGuid ) ;
67
97
}
68
98
99
+ /// <summary>
100
+ /// Verifies that the Guid property round-trips to the SqlGuid property correctly.
101
+ /// </summary>
69
102
[ Fact ]
70
103
public void SqlGuidShouldReturnExpectedWhenGuidIsSet ( )
71
104
{
@@ -76,6 +109,9 @@ public void SqlGuidShouldReturnExpectedWhenGuidIsSet()
76
109
Assert . Equal ( expected , _target . SqlGuid ) ;
77
110
}
78
111
112
+ /// <summary>
113
+ /// Verifies that the SqlGuid property round-trips correctly.
114
+ /// </summary>
79
115
[ Fact ]
80
116
public void SqlGuidShouldReturnExpectedWhenSqlGuidIsSet ( )
81
117
{
@@ -85,6 +121,9 @@ public void SqlGuidShouldReturnExpectedWhenSqlGuidIsSet()
85
121
Assert . Equal ( expected , _target . SqlGuid ) ;
86
122
}
87
123
124
+ /// <summary>
125
+ /// Verifies that the Guid property round-trips to the SqlValue property correctly.
126
+ /// </summary>
88
127
[ Fact ]
89
128
public void SqlValueShouldReturnExpectedWhenGuidIsSet ( )
90
129
{
@@ -95,6 +134,9 @@ public void SqlValueShouldReturnExpectedWhenGuidIsSet()
95
134
Assert . Equal ( expected , _target . SqlValue ) ;
96
135
}
97
136
137
+ /// <summary>
138
+ /// Verifies that the SqlGuid property round-trips to the SqlValue property correctly.
139
+ /// </summary>
98
140
[ Fact ]
99
141
public void SqlValueShouldReturnExpectedWhenSqlGuidIsSet ( )
100
142
{
0 commit comments