Skip to content

Commit 9f195c9

Browse files
committed
Add and correct comments
Also mandating this by generating a documentation XML file
1 parent bd49514 commit 9f195c9

File tree

7 files changed

+103
-56
lines changed

7 files changed

+103
-56
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@
44

55
namespace Microsoft.Data.SqlClient.UnitTests
66
{
7+
/// <summary>
8+
/// Tests proving that the InternalsVisibleTo attribute works correctly.
9+
/// </summary>
710
public class InternalsVisibleToTest
811
{
12+
/// <summary>
13+
/// Creates an instance of an internal class. Verifies that this compiles.
14+
/// </summary>
915
[Fact]
1016
public void TestInternalsVisible()
1117
{

src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft.Data.SqlClient.UnitTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<IntermediateOutputPath>$(ObjFolder)$(Configuration).$(Platform).$(AssemblyName)</IntermediateOutputPath>
88
<OutputPath>$(BinFolder)$(Configuration).$(Platform).$(AssemblyName)</OutputPath>
99
<IsTestProject>true</IsTestProject>
10+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1011
</PropertyGroup>
1112
<!-- Common references -->
1213
<ItemGroup>

src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/ConnectionPool/ChannelDbConnectionPoolTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Microsoft.Data.SqlClient.UnitTests
1313
{
14+
#pragma warning disable CS1591 // Test classes do not require XML documentation comments
1415
public class ChannelDbConnectionPoolTest
1516
{
1617
private readonly ChannelDbConnectionPool _pool;
@@ -152,4 +153,5 @@ public void TestTryGetConnection()
152153
Assert.Throws<NotImplementedException>(() => _pool.TryGetConnection(null!, null!, null!, out _));
153154
}
154155
}
156+
#pragma warning restore CS1591
155157
}

src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/UdtSerialization/InvalidSerializationTest.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@
1111

1212
namespace Microsoft.Data.SqlClient.UnitTests.UdtSerialization;
1313

14+
/// <summary>
15+
/// Attempts to serialize types which do not meet the requirements for either user-defined or native serialization.
16+
/// </summary>
1417
public class InvalidSerializationTest
1518
{
19+
/// <summary>
20+
/// Attempts to serialize a class that does not have the SqlUserDefinedType attribute. Verifies that this fails.
21+
/// </summary>
1622
[Fact]
1723
public void RequiresSqlUserDefinedTypeAttribute()
1824
{
@@ -24,6 +30,10 @@ public void RequiresSqlUserDefinedTypeAttribute()
2430
Assert.Equal($"'{typeof(ClassMissingSqlUserDefinedTypeAttribute).FullName}' is an invalid user defined type, reason: no UDT attribute.", exception.Message);
2531
}
2632

33+
/// <summary>
34+
/// Attempts to serialize a class that has a SqlUserDefinedType attribute, but specifies a Format enumeration value of
35+
/// Unknown. Verifies that this fails.
36+
/// </summary>
2737
[Fact]
2838
public void CannotSerializeUnknownFormattedType()
2939
{

src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/UdtSerialization/NativeSerializationTest.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ namespace Microsoft.Data.SqlClient.UnitTests.UdtSerialization;
1818
/// <seealso href="https://learn.microsoft.com/en-us/openspecs/sql_server_protocols/ms-ssclrt/77460aa9-8c2f-4449-a65e-1d649ebd77fa"/>
1919
public class NativeSerializationTest
2020
{
21+
/// <summary>
22+
/// Provides a collection of test data representing non-null primitive type values and their corresponding
23+
/// serialized byte arrays.
24+
/// </summary>
25+
/// <see cref="SerializePrimitiveType"/>
2126
public static IEnumerable<object[]> SerializedNonNullPrimitiveTypeValues()
2227
{
2328
yield return [new BoolWrapperStruct { Field1 = true },
@@ -62,6 +67,10 @@ public static IEnumerable<object[]> SerializedNonNullPrimitiveTypeValues()
6267
new byte[] { 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0xF8 }];
6368
}
6469

70+
/// <summary>
71+
/// Provides a collection of test data representing serialized values of nested non-null primitive types.
72+
/// </summary>
73+
/// <see cref="SerializeNestedPrimitiveType"/>
6574
public static IEnumerable<object[]> SerializedNestedNonNullPrimitiveTypeValues()
6675
{
6776
yield return [new NestedBoolWrapperStruct { Field1 = true, Field2 = new BoolWrapperStruct { Field1 = false } },
@@ -126,6 +135,10 @@ public static IEnumerable<object[]> SerializedNestedNonNullPrimitiveTypeValues()
126135
0x01, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x9C, 0x64 }];
127136
}
128137

138+
/// <summary>
139+
/// Provides a collection of test data representing serialized null values for various primitive types.
140+
/// </summary>
141+
/// <see cref="SerializeNullPrimitiveType"/>
129142
public static IEnumerable<object[]> SerializedNullPrimitiveTypeValues()
130143
{
131144
yield return [new SqlByteWrapperStruct { Field1 = SqlByte.Null },
@@ -182,7 +195,7 @@ public void SerializeNullPrimitiveType(object primitive, byte[] expectedValue)
182195
=> RoundtripType(primitive, expectedValue);
183196

184197
/// <summary>
185-
/// Attempts to serializes an instance of a class.
198+
/// Attempts to serialize an instance of a class.
186199
/// </summary>
187200
/// <seealso cref="CannotSerializeNestedClass"/>
188201
[Fact]
@@ -199,11 +212,10 @@ public void CanSerializeTopLevelClass()
199212
}
200213

201214
/// <summary>
202-
/// Attempts to serializes a field referring to an instance of a class.
203-
/// Verifies that this succeeds, and that Native format serialization only operates with primitive types
204-
/// and value types containing these.
215+
/// Attempts to serialize a field referring to an instance of a class.
216+
/// Verifies that this fails, and that Native format serialization only operates with primitive types and value types containing these.
205217
/// </summary>
206-
/// <seealso cref="CannotSerializeNestedClass"/>
218+
/// <seealso cref="CanSerializeTopLevelClass"/>
207219
[Fact]
208220
public void CannotSerializeNestedClass()
209221
{

0 commit comments

Comments
 (0)