Skip to content

Commit 0c52987

Browse files
committed
CSHARP-1434: Fix compile time warning and remove obsolete test. Turn on "Treat Warnings as Errors" for all projects.
1 parent dd98794 commit 0c52987

File tree

10 files changed

+10
-17
lines changed

10 files changed

+10
-17
lines changed

src/MongoDB.Bson.TestHelpers/MongoDB.Bson.TestHelpers.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<DefineConstants>DEBUG;TRACE</DefineConstants>
2020
<ErrorReport>prompt</ErrorReport>
2121
<WarningLevel>4</WarningLevel>
22+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2223
</PropertyGroup>
2324
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2425
<DebugType>pdbonly</DebugType>

src/MongoDB.Driver.Core.TestHelpers/MongoDB.Driver.Core.TestHelpers.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<DefineConstants>DEBUG;TRACE</DefineConstants>
2020
<ErrorReport>prompt</ErrorReport>
2121
<WarningLevel>4</WarningLevel>
22+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2223
</PropertyGroup>
2324
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2425
<DebugType>pdbonly</DebugType>

src/MongoDB.Driver.Core.Tests/MongoDB.Driver.Core.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<DefineConstants>DEBUG;TRACE</DefineConstants>
2020
<ErrorReport>prompt</ErrorReport>
2121
<WarningLevel>4</WarningLevel>
22+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2223
</PropertyGroup>
2324
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2425
<DebugType>pdbonly</DebugType>

src/MongoDB.Driver.Legacy.TestHelpers/MongoDB.Driver.Legacy.TestHelpers.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<DefineConstants>DEBUG;TRACE</DefineConstants>
2020
<ErrorReport>prompt</ErrorReport>
2121
<WarningLevel>4</WarningLevel>
22+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2223
</PropertyGroup>
2324
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2425
<DebugType>pdbonly</DebugType>

src/MongoDB.Driver.Legacy.Tests/MongoDB.Driver.Legacy.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<DefineConstants>DEBUG;TRACE</DefineConstants>
2020
<ErrorReport>prompt</ErrorReport>
2121
<WarningLevel>4</WarningLevel>
22+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2223
</PropertyGroup>
2324
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2425
<DebugType>pdbonly</DebugType>

src/MongoDB.Driver.Legacy.Tests/MongoServerTests.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -194,22 +194,6 @@ public void TestIsDatabaseNameValid()
194194
Assert.IsTrue(_server.IsDatabaseNameValid("$external", out message));
195195
}
196196

197-
[Test]
198-
public void TestPassives()
199-
{
200-
if (_isReplicaSet)
201-
{
202-
var isMasterResult = _database.RunCommand("isMaster").Response;
203-
BsonValue passives;
204-
int passiveCount = 0;
205-
if (isMasterResult.TryGetValue("passives", out passives))
206-
{
207-
passiveCount = passives.AsBsonArray.Count;
208-
}
209-
Assert.AreEqual(passiveCount, _server.Passives.Length);
210-
}
211-
}
212-
213197
[Test]
214198
public void TestPing()
215199
{

src/MongoDB.Driver.Legacy.VB.Tests/MongoDB.Driver.Legacy.VB.Tests.vbproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<OutputPath>bin\Debug\</OutputPath>
2525
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
2626
<Prefer32Bit>false</Prefer32Bit>
27+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2728
</PropertyGroup>
2829
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2930
<DebugType>pdbonly</DebugType>
@@ -33,6 +34,7 @@
3334
<OutputPath>bin\Release\</OutputPath>
3435
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
3536
<Prefer32Bit>false</Prefer32Bit>
37+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
3638
</PropertyGroup>
3739
<PropertyGroup>
3840
<OptionExplicit>On</OptionExplicit>

src/MongoDB.Driver.TestConsoleApplication/MongoDB.Driver.TestConsoleApplication.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
<ErrorReport>prompt</ErrorReport>
3838
<WarningLevel>4</WarningLevel>
3939
<UseVSHostingProcess>false</UseVSHostingProcess>
40+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
4041
</PropertyGroup>
4142
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
4243
<PlatformTarget>AnyCPU</PlatformTarget>

src/MongoDB.Driver.TestHelpers/MongoDB.Driver.TestHelpers.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<DefineConstants>DEBUG;TRACE</DefineConstants>
2020
<ErrorReport>prompt</ErrorReport>
2121
<WarningLevel>4</WarningLevel>
22+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2223
</PropertyGroup>
2324
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2425
<DebugType>pdbonly</DebugType>

src/MongoDB.Driver.Tests/MongoDB.Driver.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<DefineConstants>DEBUG;TRACE</DefineConstants>
4242
<ErrorReport>prompt</ErrorReport>
4343
<WarningLevel>4</WarningLevel>
44-
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
44+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
4545
<Prefer32Bit>false</Prefer32Bit>
4646
</PropertyGroup>
4747
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">

0 commit comments

Comments
 (0)