diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 0000000..36f22a6
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,8 @@
+
+
+
+ 10
+ enable
+ enable
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 77aab19..0f0e8c7 100644
--- a/README.md
+++ b/README.md
@@ -45,7 +45,6 @@ await collection.FindAsync(Builders.Filter.Eq("_id", "blah"),
new FindOptions());
await Verifier.Verify("collection");
-
```
Will result in the following verified file:
diff --git a/Verify.MongoDB.Tests/IntegrationTests.cs b/Verify.MongoDB.Tests/IntegrationTests.cs
index c89717f..c3778c1 100644
--- a/Verify.MongoDB.Tests/IntegrationTests.cs
+++ b/Verify.MongoDB.Tests/IntegrationTests.cs
@@ -1,11 +1,6 @@
-using System.IO;
-using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using MongoDB.Bson;
using MongoDB.Driver;
-using VerifyTests;
-using VerifyXunit;
-using Xunit;
namespace Verify.MongoDB.Tests;
@@ -22,7 +17,7 @@ public async Task FindAsync()
{
var configuration = GetConfiguration();
- var clientSettings = MongoClientSettings.FromUrl(new MongoUrl(configuration["MongoConnectionString"]));
+ var clientSettings = MongoClientSettings.FromUrl(new(configuration["MongoConnectionString"]));
clientSettings.EnableRecording();
@@ -38,7 +33,7 @@ public async Task FindAsync()
await collection.FindAsync(Builders.Filter.Eq("_id", "blah"),
new FindOptions());
-
+
await Verifier.Verify("collection");
}
@@ -47,7 +42,7 @@ public async Task InsertOneAsync()
{
var configuration = GetConfiguration();
- var clientSettings = MongoClientSettings.FromUrl(new MongoUrl(configuration["MongoConnectionString"]));
+ var clientSettings = MongoClientSettings.FromUrl(new(configuration["MongoConnectionString"]));
clientSettings.EnableRecording();
@@ -61,7 +56,7 @@ public async Task InsertOneAsync()
MongoDBRecording.StartRecording();
- await collection.InsertOneAsync(new BsonDocument()
+ await collection.InsertOneAsync(new()
{
{"_id", "C2E1B774-A997-4818-B104-E915F7DCA9C1"}
});
@@ -71,10 +66,9 @@ await collection.InsertOneAsync(new BsonDocument()
private static IConfigurationRoot GetConfiguration()
{
- var configuration = new ConfigurationBuilder()
+ return new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("local.settings.json", false)
.Build();
- return configuration;
}
}
\ No newline at end of file
diff --git a/Verify.MongoDB.Tests/Verify.MongoDB.Tests.csproj b/Verify.MongoDB.Tests/Verify.MongoDB.Tests.csproj
index 73d665c..b998ae3 100644
--- a/Verify.MongoDB.Tests/Verify.MongoDB.Tests.csproj
+++ b/Verify.MongoDB.Tests/Verify.MongoDB.Tests.csproj
@@ -2,8 +2,6 @@
net6.0
- enable
-
false
@@ -36,9 +34,6 @@
PreserveNewest
Never
-
- IntegrationTests.cs
-
diff --git a/Verify.MongoDB/LogCommandInterceptor.cs b/Verify.MongoDB/LogCommandInterceptor.cs
index f2791cc..149b0e9 100644
--- a/Verify.MongoDB/LogCommandInterceptor.cs
+++ b/Verify.MongoDB/LogCommandInterceptor.cs
@@ -9,7 +9,7 @@ public class LogCommandInterceptor
public static void Start()
{
- asyncLocal.Value = new State();
+ asyncLocal.Value = new();
}
public static IEnumerable? Stop()
diff --git a/Verify.MongoDB/MongoDBRecording.cs b/Verify.MongoDB/MongoDBRecording.cs
index 5463bc8..95d069d 100644
--- a/Verify.MongoDB/MongoDBRecording.cs
+++ b/Verify.MongoDB/MongoDBRecording.cs
@@ -40,6 +40,6 @@ public static IEnumerable FinishRecording()
{
return entries;
}
- throw new Exception("No recorded state. It is possible `MongoRecording.StartRecording()` has not been called on the MongoClient.");
+ throw new("No recorded state. It is possible `MongoRecording.StartRecording()` has not been called on the MongoClient.");
}
}
\ No newline at end of file
diff --git a/Verify.MongoDB/Verify.MongoDB.csproj b/Verify.MongoDB/Verify.MongoDB.csproj
index 97ec924..7398851 100644
--- a/Verify.MongoDB/Verify.MongoDB.csproj
+++ b/Verify.MongoDB/Verify.MongoDB.csproj
@@ -2,13 +2,10 @@
netcoreapp3.1;net6.0
- enable
- enable
- $(MSBuildProjectName.Replace(" ", "_"))
- 10
+ $(MSBuildProjectName.Replace(" ", "_"))
-
+