Skip to content

Commit 2731bb5

Browse files
authored
Merge pull request #147 from fauna/OSS-693-remove-warnings
OSS-693: Remove all warnings
2 parents 06f606b + e9b61b8 commit 2731bb5

File tree

5 files changed

+55
-12
lines changed

5 files changed

+55
-12
lines changed

FaunaDB.Client.Test/ClientTest.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -892,9 +892,13 @@ [Test] public async Task TestEvalContainsExpressions()
892892
var favoritesObj = Obj("favorites", foodsObj);
893893

894894
// Deprecated
895-
895+
#pragma warning disable CS0618 // Type or member is obsolete
896896
Assert.AreEqual(BooleanV.True,
897897
await client.Query(Contains(Path("favorites", "foods"), favoritesObj)));
898+
#pragma warning restore CS0618 // Type or member is obsolete
899+
900+
Assert.AreEqual(BooleanV.True,
901+
await client.Query(ContainsPath(Path("favorites", "foods"), favoritesObj)));
898902

899903
// Field
900904

@@ -1066,7 +1070,7 @@ [Test] public async Task TestEvalDivideExpression()
10661070
Assert.AreEqual(10L, res.To<long>().Value);
10671071
}
10681072

1069-
[Test] public async Task TestEvalDivideExpressionWrongArgument()
1073+
[Test] public void TestEvalDivideExpressionWrongArgument()
10701074
{
10711075
var ex = Assert.ThrowsAsync<BadRequest>(
10721076
async() => await client.Query(Divide(Null(), 10))
@@ -2587,7 +2591,7 @@ public async Task TestToDouble()
25872591
}
25882592

25892593
[Test]
2590-
public async Task TestThrowBadRequestOnDouble()
2594+
public void TestThrowBadRequestOnDouble()
25912595
{
25922596
var ex = Assert.ThrowsAsync<BadRequest>(
25932597
async () => await adminClient.Query(ToDouble(Now()))
@@ -2609,7 +2613,7 @@ public async Task TestToInteger()
26092613
}
26102614

26112615
[Test]
2612-
public async Task TestThrowBadRequestOnInteger()
2616+
public void TestThrowBadRequestOnInteger()
26132617
{
26142618
var ex = Assert.ThrowsAsync<BadRequest>(
26152619
async () => await adminClient.Query(ToInteger(Now()))

FaunaDB.Client.Test/DecoderTest.cs

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,22 @@ struct Point
4646
{
4747
public int X;
4848
public int Y;
49+
public Point(int x, int y)
50+
{
51+
X = x;
52+
Y = y;
53+
}
4954
}
5055

5156
struct Rect
5257
{
5358
public Point UpperLeft;
54-
public Point BottonRight;
59+
public Point BottomRight;
60+
public Rect(Point upperLeft, Point bottomRight)
61+
{
62+
UpperLeft = upperLeft;
63+
BottomRight = bottomRight;
64+
}
5565
}
5666

5767
[Test]
@@ -78,7 +88,7 @@ public void TestNullToValueTypes()
7888

7989
Assert.AreEqual(default(Rect), Decode<Rect>(NullV.Instance));
8090
Assert.AreEqual(default(Rect), Decode<Rect>(ObjectV.Empty));
81-
Assert.AreEqual(default(Rect), Decode<Rect>(ObjectV.With("UpperLeft", NullV.Instance, "BottonRight", NullV.Instance)));
91+
Assert.AreEqual(default(Rect), Decode<Rect>(ObjectV.With("UpperLeft", NullV.Instance, "BottomRight", NullV.Instance)));
8292

8393
//
8494

@@ -214,6 +224,11 @@ public override bool Equals(object obj)
214224
Created == product.Created &&
215225
LastUpdated == product.LastUpdated;
216226
}
227+
228+
public override int GetHashCode()
229+
{
230+
return base.GetHashCode();
231+
}
217232
}
218233

219234
[Test]
@@ -369,7 +384,7 @@ class MissingPropertiesOnConstructor
369384
public string Field1 { get; set; }
370385

371386
[FaunaField("a_missing_field")]
372-
string field2;
387+
string field2 = default(string);
373388

374389
public string Field2 { get { return field2; } }
375390

@@ -399,7 +414,7 @@ class MissingPropertiesOnMethodCreator
399414
public string Field1 { get; set; }
400415

401416
[FaunaField("a_missing_field")]
402-
string field2;
417+
string field2 = default(string);
403418

404419
public string Field2 { get { return field2; } }
405420

@@ -701,13 +716,24 @@ struct NestedStruct
701716
{
702717
public byte? aByte;
703718
public short? aShort;
719+
public NestedStruct(byte? abyte, short? ashort)
720+
{
721+
aByte = abyte;
722+
aShort = ashort;
723+
}
704724
}
705725

706726
struct StructWithNullableFields
707727
{
708728
public int? anInteger;
709729
public double? aDouble;
710730
public NestedStruct? aStruct;
731+
public StructWithNullableFields(int? intVal, double? doubleVal, NestedStruct? structVal)
732+
{
733+
anInteger = intVal;
734+
aDouble = doubleVal;
735+
aStruct = structVal;
736+
}
711737
}
712738

713739
[Test]

FaunaDB.Client.Test/FaunaDB.Client.Test.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
net45 => applicable for .net framework version up to 4.8, means if you target
1313
.net frameworks net45 till net48, FaunaDB.Client net45 build will be used
1414
-->
15-
<TargetFrameworks>net45;netcoreapp1.1;netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
15+
<TargetFrameworks>net45;netcoreapp2.1;netcoreapp3.1;net5.0</TargetFrameworks>
16+
</PropertyGroup>
17+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net45|AnyCPU'">
18+
<WarningsAsErrors>;NU1605</WarningsAsErrors>
19+
<NoWarn>1701;1702;</NoWarn>
1620
</PropertyGroup>
1721

1822
<ItemGroup>

FaunaDB.Client.Test/SerializationTest.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,8 +755,17 @@ [Test] public void TestEquals()
755755

756756
[Test] public void TestContains()
757757
{
758+
#pragma warning disable CS0618 // Type or member is obsolete
758759
AssertJsonEqual(Contains(Arr("favorites", "foods"), Obj("favorites", Obj("foods", Arr("crunchings", "munchings", "lunchings")))),
759760
"{\"contains\":[\"favorites\",\"foods\"],\"in\":{\"object\":{\"favorites\":{\"object\":{\"foods\":[\"crunchings\",\"munchings\",\"lunchings\"]}}}}}");
761+
#pragma warning restore CS0618 // Type or member is obsolete
762+
}
763+
764+
[Test]
765+
public void TestContainsPath()
766+
{
767+
AssertJsonEqual(ContainsPath(Arr("favorites", "foods"), Obj("favorites", Obj("foods", Arr("crunchings", "munchings", "lunchings")))),
768+
"{\"contains_path\":[\"favorites\",\"foods\"],\"in\":{\"object\":{\"favorites\":{\"object\":{\"foods\":[\"crunchings\",\"munchings\",\"lunchings\"]}}}}}");
760769
}
761770

762771
[Test] public void TestSelect()

FaunaDB.Client.Test/StreamingTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async Task SetUpAsync()
2525
}
2626

2727
[Test]
28-
public async Task TestThatStreamFailsIfTargetDoesNotExist()
28+
public void TestThatStreamFailsIfTargetDoesNotExist()
2929
{
3030
AsyncTestDelegate doc = async () => { await adminClient.Stream(Get(Ref(Collection("streams_test"), "1234"))); };
3131

@@ -35,7 +35,7 @@ public async Task TestThatStreamFailsIfTargetDoesNotExist()
3535
}
3636

3737
[Test]
38-
public async Task TestStreamFailsIfIncorrectValuePassedToStreamMethod()
38+
public void TestStreamFailsIfIncorrectValuePassedToStreamMethod()
3939
{
4040
AsyncTestDelegate doc = async () => { await adminClient.Stream(Collection("streams_test")); };
4141

@@ -45,7 +45,7 @@ public async Task TestStreamFailsIfIncorrectValuePassedToStreamMethod()
4545
}
4646

4747
[Test]
48-
public async Task TestStreamFailsIfQueryIsNotReadOnly()
48+
public void TestStreamFailsIfQueryIsNotReadOnly()
4949
{
5050
AsyncTestDelegate doc = async () => { await adminClient.Stream(CreateCollection(Collection("streams_test"))); };
5151

0 commit comments

Comments
 (0)