Skip to content

Commit 2bcd59a

Browse files
committed
Adhere to project code style: namespace statements
1 parent ef39275 commit 2bcd59a

File tree

3 files changed

+345
-348
lines changed

3 files changed

+345
-348
lines changed

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

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,29 @@
55
using System;
66
using Xunit;
77

8-
namespace Microsoft.Data.SqlClient.UnitTests
8+
namespace Microsoft.Data.SqlClient.UnitTests;
9+
10+
/// <summary>
11+
/// Provides unit tests for verifying the default values of all SqlClient-specific AppContext switches.
12+
/// </summary>
13+
public class LocalAppContextSwitchesTest
914
{
1015
/// <summary>
11-
/// Provides unit tests for verifying the default values of all SqlClient-specific AppContext switches.
16+
/// Tests the default values of every AppContext switch used by SqlClient.
1217
/// </summary>
13-
public class LocalAppContextSwitchesTest
18+
[Fact]
19+
public void TestDefaultAppContextSwitchValues()
1420
{
15-
/// <summary>
16-
/// Tests the default values of every AppContext switch used by SqlClient.
17-
/// </summary>
18-
[Fact]
19-
public void TestDefaultAppContextSwitchValues()
20-
{
21-
Assert.False(LocalAppContextSwitches.LegacyRowVersionNullBehavior);
22-
Assert.False(LocalAppContextSwitches.SuppressInsecureTlsWarning);
23-
Assert.False(LocalAppContextSwitches.MakeReadAsyncBlocking);
24-
Assert.True(LocalAppContextSwitches.UseMinimumLoginTimeout);
25-
Assert.True(LocalAppContextSwitches.LegacyVarTimeZeroScaleBehaviour);
26-
Assert.False(LocalAppContextSwitches.UseCompatibilityProcessSni);
27-
Assert.False(LocalAppContextSwitches.UseCompatibilityAsyncBehaviour);
28-
Assert.False(LocalAppContextSwitches.UseConnectionPoolV2);
29-
#if NETFRAMEWORK
30-
Assert.False(LocalAppContextSwitches.DisableTnirByDefault);
31-
#endif
32-
}
21+
Assert.False(LocalAppContextSwitches.LegacyRowVersionNullBehavior);
22+
Assert.False(LocalAppContextSwitches.SuppressInsecureTlsWarning);
23+
Assert.False(LocalAppContextSwitches.MakeReadAsyncBlocking);
24+
Assert.True(LocalAppContextSwitches.UseMinimumLoginTimeout);
25+
Assert.True(LocalAppContextSwitches.LegacyVarTimeZeroScaleBehaviour);
26+
Assert.False(LocalAppContextSwitches.UseCompatibilityProcessSni);
27+
Assert.False(LocalAppContextSwitches.UseCompatibilityAsyncBehaviour);
28+
Assert.False(LocalAppContextSwitches.UseConnectionPoolV2);
29+
#if NETFRAMEWORK
30+
Assert.False(LocalAppContextSwitches.DisableTnirByDefault);
31+
#endif
3332
}
3433
}

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

Lines changed: 134 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -6,144 +6,143 @@
66
using System.Data.SqlTypes;
77
using Xunit;
88

9-
namespace Microsoft.Data.SqlClient.UnitTests
9+
namespace Microsoft.Data.SqlClient.UnitTests;
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>
19+
public sealed class SqlBufferTest
1020
{
21+
private readonly SqlBuffer _target = new();
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>
27+
[Fact]
28+
public void GuidShouldThrowWhenSqlGuidNullIsSet()
29+
{
30+
_target.SqlGuid = SqlGuid.Null;
31+
32+
Assert.Throws<SqlNullValueException>(() => _target.Guid);
33+
}
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>
39+
[Theory]
40+
[InlineData(SqlBuffer.StorageType.Guid)]
41+
[InlineData(SqlBuffer.StorageType.SqlGuid)]
42+
internal void GuidShouldThrowWhenSetToNullOfTypeIsCalled(SqlBuffer.StorageType storageType)
43+
{
44+
_target.SetToNullOfType(storageType);
45+
46+
Assert.Throws<SqlNullValueException>(() => _target.Guid);
47+
}
48+
49+
/// <summary>
50+
/// Verifies that the Guid property round-trips correctly.
51+
/// </summary>
52+
[Fact]
53+
public void GuidShouldReturnWhenGuidIsSet()
54+
{
55+
var expected = Guid.NewGuid();
56+
_target.Guid = expected;
57+
58+
Assert.Equal(expected, _target.Guid);
59+
}
60+
61+
/// <summary>
62+
/// Verifies that the SqlGuid property round-trips to the Guid property correctly.
63+
/// </summary>
64+
[Fact]
65+
public void GuidShouldReturnExpectedWhenSqlGuidIsSet()
66+
{
67+
var expected = Guid.NewGuid();
68+
_target.SqlGuid = expected;
69+
70+
Assert.Equal(expected, _target.Guid);
71+
}
72+
1173
/// <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.
74+
/// Verifies that if a SqlBuffer is set to null of type Guid or SqlGuid, accessing its SqlGuid property returns
75+
/// SqlGuid.Null.
1476
/// </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>
19-
public sealed class SqlBufferTest
77+
[Theory]
78+
[InlineData(SqlBuffer.StorageType.Guid)]
79+
[InlineData(SqlBuffer.StorageType.SqlGuid)]
80+
internal void SqlGuidShouldReturnSqlNullWhenSetToNullOfTypeIsCalled(SqlBuffer.StorageType storageType)
2081
{
21-
private readonly SqlBuffer _target = new();
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>
27-
[Fact]
28-
public void GuidShouldThrowWhenSqlGuidNullIsSet()
29-
{
30-
_target.SqlGuid = SqlGuid.Null;
31-
32-
Assert.Throws<SqlNullValueException>(() => _target.Guid);
33-
}
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>
39-
[Theory]
40-
[InlineData(SqlBuffer.StorageType.Guid)]
41-
[InlineData(SqlBuffer.StorageType.SqlGuid)]
42-
internal void GuidShouldThrowWhenSetToNullOfTypeIsCalled(SqlBuffer.StorageType storageType)
43-
{
44-
_target.SetToNullOfType(storageType);
45-
46-
Assert.Throws<SqlNullValueException>(() => _target.Guid);
47-
}
48-
49-
/// <summary>
50-
/// Verifies that the Guid property round-trips correctly.
51-
/// </summary>
52-
[Fact]
53-
public void GuidShouldReturnWhenGuidIsSet()
54-
{
55-
var expected = Guid.NewGuid();
56-
_target.Guid = expected;
57-
58-
Assert.Equal(expected, _target.Guid);
59-
}
60-
61-
/// <summary>
62-
/// Verifies that the SqlGuid property round-trips to the Guid property correctly.
63-
/// </summary>
64-
[Fact]
65-
public void GuidShouldReturnExpectedWhenSqlGuidIsSet()
66-
{
67-
var expected = Guid.NewGuid();
68-
_target.SqlGuid = expected;
69-
70-
Assert.Equal(expected, _target.Guid);
71-
}
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>
77-
[Theory]
78-
[InlineData(SqlBuffer.StorageType.Guid)]
79-
[InlineData(SqlBuffer.StorageType.SqlGuid)]
80-
internal void SqlGuidShouldReturnSqlNullWhenSetToNullOfTypeIsCalled(SqlBuffer.StorageType storageType)
81-
{
82-
_target.SetToNullOfType(storageType);
83-
84-
Assert.Equal(SqlGuid.Null, _target.SqlGuid);
85-
}
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>
91-
[Fact]
92-
public void SqlGuidShouldReturnSqlGuidNullWhenSqlGuidNullIsSet()
93-
{
94-
_target.SqlGuid = SqlGuid.Null;
95-
96-
Assert.Equal(SqlGuid.Null, _target.SqlGuid);
97-
}
98-
99-
/// <summary>
100-
/// Verifies that the Guid property round-trips to the SqlGuid property correctly.
101-
/// </summary>
102-
[Fact]
103-
public void SqlGuidShouldReturnExpectedWhenGuidIsSet()
104-
{
105-
var guid = Guid.NewGuid();
106-
SqlGuid expected = guid;
107-
_target.Guid = guid;
108-
109-
Assert.Equal(expected, _target.SqlGuid);
110-
}
111-
112-
/// <summary>
113-
/// Verifies that the SqlGuid property round-trips correctly.
114-
/// </summary>
115-
[Fact]
116-
public void SqlGuidShouldReturnExpectedWhenSqlGuidIsSet()
117-
{
118-
SqlGuid expected = Guid.NewGuid();
119-
_target.SqlGuid = expected;
120-
121-
Assert.Equal(expected, _target.SqlGuid);
122-
}
123-
124-
/// <summary>
125-
/// Verifies that the Guid property round-trips to the SqlValue property correctly.
126-
/// </summary>
127-
[Fact]
128-
public void SqlValueShouldReturnExpectedWhenGuidIsSet()
129-
{
130-
var guid = Guid.NewGuid();
131-
SqlGuid expected = guid;
132-
_target.Guid = guid;
133-
134-
Assert.Equal(expected, _target.SqlValue);
135-
}
136-
137-
/// <summary>
138-
/// Verifies that the SqlGuid property round-trips to the SqlValue property correctly.
139-
/// </summary>
140-
[Fact]
141-
public void SqlValueShouldReturnExpectedWhenSqlGuidIsSet()
142-
{
143-
SqlGuid expected = Guid.NewGuid();
144-
_target.SqlGuid = expected;
145-
146-
Assert.Equal(expected, _target.SqlValue);
147-
}
82+
_target.SetToNullOfType(storageType);
83+
84+
Assert.Equal(SqlGuid.Null, _target.SqlGuid);
85+
}
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>
91+
[Fact]
92+
public void SqlGuidShouldReturnSqlGuidNullWhenSqlGuidNullIsSet()
93+
{
94+
_target.SqlGuid = SqlGuid.Null;
95+
96+
Assert.Equal(SqlGuid.Null, _target.SqlGuid);
97+
}
98+
99+
/// <summary>
100+
/// Verifies that the Guid property round-trips to the SqlGuid property correctly.
101+
/// </summary>
102+
[Fact]
103+
public void SqlGuidShouldReturnExpectedWhenGuidIsSet()
104+
{
105+
var guid = Guid.NewGuid();
106+
SqlGuid expected = guid;
107+
_target.Guid = guid;
108+
109+
Assert.Equal(expected, _target.SqlGuid);
110+
}
111+
112+
/// <summary>
113+
/// Verifies that the SqlGuid property round-trips correctly.
114+
/// </summary>
115+
[Fact]
116+
public void SqlGuidShouldReturnExpectedWhenSqlGuidIsSet()
117+
{
118+
SqlGuid expected = Guid.NewGuid();
119+
_target.SqlGuid = expected;
120+
121+
Assert.Equal(expected, _target.SqlGuid);
122+
}
123+
124+
/// <summary>
125+
/// Verifies that the Guid property round-trips to the SqlValue property correctly.
126+
/// </summary>
127+
[Fact]
128+
public void SqlValueShouldReturnExpectedWhenGuidIsSet()
129+
{
130+
var guid = Guid.NewGuid();
131+
SqlGuid expected = guid;
132+
_target.Guid = guid;
133+
134+
Assert.Equal(expected, _target.SqlValue);
135+
}
136+
137+
/// <summary>
138+
/// Verifies that the SqlGuid property round-trips to the SqlValue property correctly.
139+
/// </summary>
140+
[Fact]
141+
public void SqlValueShouldReturnExpectedWhenSqlGuidIsSet()
142+
{
143+
SqlGuid expected = Guid.NewGuid();
144+
_target.SqlGuid = expected;
145+
146+
Assert.Equal(expected, _target.SqlValue);
148147
}
149148
}

0 commit comments

Comments
 (0)