Skip to content

Commit

Permalink
Commit dotnet format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
adambollen committed Dec 13, 2023
1 parent 514f683 commit 59bab3e
Show file tree
Hide file tree
Showing 16 changed files with 250 additions and 236 deletions.
2 changes: 1 addition & 1 deletion Fauna.Test/Client.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public async Task LastSeenTxnPropagatesToSubsequentQueries()
Arg.IsAny<string>(),
Arg.IsAny<Dictionary<string, string>>()
)
).DoInstead((string path, string body, Dictionary<string, string> headers) =>
).DoInstead((string path, string body, Dictionary<string, string> headers) =>
{
Assert.AreEqual(1702346199930000.ToString(), headers[Headers.LastTxnTs]);
check = true;
Expand Down
4 changes: 2 additions & 2 deletions Fauna.Test/ClientConfig.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ public void FinalQueryOptions()
var defaults = new QueryOptions
{
TypeCheck = true,
QueryTags = new Dictionary<string, string> {{"foo", "bar"}, {"baz", "luhrmann"}},
QueryTags = new Dictionary<string, string> { { "foo", "bar" }, { "baz", "luhrmann" } },
QueryTimeout = TimeSpan.FromSeconds(30)
};
var overrides = new QueryOptions
{
Linearized = true,
QueryTags = new Dictionary<string, string> {{"foo", "yep"}}
QueryTags = new Dictionary<string, string> { { "foo", "yep" } }
};

var finalOptions = QueryOptions.GetFinalQueryOptions(defaults, overrides);
Expand Down
14 changes: 8 additions & 6 deletions Fauna.Test/Serialization/Serializer.Serialize.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ private class Person
public string? LastName { get; set; }
public int Age { get; set; }
}

[FaunaObject]
private class PersonWithContext
{
Expand All @@ -40,14 +40,15 @@ public void SerializeValues()
{"null", null},
};

foreach(var entry in tests)
foreach (var entry in tests)
{
var result = Serializer.Serialize(entry.Value);
Assert.AreEqual(entry.Key, result);
}
}

[Test] public void SerializeUserDefinedClass()

[Test]
public void SerializeUserDefinedClass()
{
var test = new Person
{
Expand All @@ -59,8 +60,9 @@ [Test] public void SerializeUserDefinedClass()
var actual = Serializer.Serialize(test);
Assert.AreEqual("""{"FirstName":"Baz","LastName":"Luhrmann","Age":{"@int":"61"}}""", actual);
}

[Test] public void SerializeUserDefinedClassWithContext()

[Test]
public void SerializeUserDefinedClassWithContext()
{
var test = new PersonWithContext
{
Expand Down
36 changes: 18 additions & 18 deletions Fauna.Test/Serialization/Serializer.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ namespace Fauna.Test.Serialization;
[TestFixture]
public class SerializerTests
{

private class TestPerson
{
public string? FirstName { get; set; }
public string? LastName { get; set; }
public int Age { get; set; }
}

[FaunaObject]
private class TestPersonWithAttributes
{
Expand All @@ -28,7 +28,7 @@ private class TestPersonWithAttributes
public string? Ignored { get; set; }
}


[Test]
public void DeserializeValues()
{
Expand All @@ -44,14 +44,14 @@ public void DeserializeValues()
{"false", false},
{"null", null},
};
foreach(KeyValuePair<string, object?> entry in tests)

foreach (KeyValuePair<string, object?> entry in tests)
{
var result = Serializer.Deserialize(entry.Key);
Assert.AreEqual(entry.Value, result);
}
}

[Test]
public void DeserializeObject()
{
Expand All @@ -74,7 +74,7 @@ public void DeserializeObject()
{
{ "baz", "luhrmann" }
};

var expected = new Dictionary<string, object?>
{
{ "aString", "foo" },
Expand All @@ -88,11 +88,11 @@ public void DeserializeObject()
{ "false", false },
{ "null", null }
};

var result = Serializer.Deserialize(given);
Assert.AreEqual(expected, result);
}

[Test]
public void DeserializeEscapedObject()
{
Expand All @@ -111,39 +111,39 @@ public void DeserializeEscapedObject()
{
{ "@long", "notalong" }
};

var expected = new Dictionary<string, object>
{
{ "@int", "notanint" },
{ "anInt", 123 },
{ "@object", "notanobject" },
{ "anEscapedObject", inner }

};

var result = Serializer.Deserialize(given);
Assert.AreEqual(expected, result);
}


[Test]
public void DeserializeIntoPoco()
{

const string given = """
{
"FirstName": "Baz",
"LastName": "Luhrmann",
"Age": { "@int": "61" }
}
""";

var p = Serializer.Deserialize<TestPerson>(given);
Assert.AreEqual("Baz", p.FirstName);

Check warning on line 142 in Fauna.Test/Serialization/Serializer.Tests.cs

View workflow job for this annotation

GitHub Actions / test (8.0.x)

Dereference of a possibly null reference.
Assert.AreEqual("Luhrmann", p.LastName);
Assert.AreEqual(61, p.Age);
}

[Test]
public void DeserializeIntoPocoWithAttributes()
{
Expand All @@ -155,7 +155,7 @@ public void DeserializeIntoPocoWithAttributes()
"Ignored": "should be null"
}
""";

var p = Serializer.Deserialize<TestPersonWithAttributes>(given);
Assert.AreEqual("Baz", p.FirstName);

Check warning on line 160 in Fauna.Test/Serialization/Serializer.Tests.cs

View workflow job for this annotation

GitHub Actions / test (8.0.x)

Dereference of a possibly null reference.
Assert.AreEqual("Luhrmann", p.LastName);
Expand Down
Loading

0 comments on commit 59bab3e

Please sign in to comment.