Repository: dotnet/efcore
File: test/EFCore.Specification.Tests/LazyLoadProxyTestBase.cs (C#)

Code before:
        context.ChangeTracker.LazyLoadingEnabled = false;

        Assert.Equal(2, parent.Children!.Count());
        Assert.All(parent.Children!.Select(e => e.Parent), c => Assert.Same(parent, c));

        Assert.Equal(state == EntityState.Detached ? 0 : 3, context.ChangeTracker.Entries().Count());
    }

    [ConditionalFact]
    public virtual void Can_serialize_proxies_to_JSON()
    {
        using var context = CreateContext(lazyLoadingEnabled: true);

        var blogs = context.Set<Blog>().OrderBy(e => e.Id).ToList();

        VerifyBlogs(blogs);
        foreach (var blog in blogs)
        {
            Assert.IsNotType<Blog>(blog);
        }

        var serialized = JsonConvert.SerializeObject(
            blogs,
            new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore, Formatting = Formatting.Indented });


        Assert.Equal(SerializedBlogs1, serialized, ignoreLineEndingDifferences: true);

        var newBlogs = JsonConvert.DeserializeObject<List<Blog>>(serialized)!;

        VerifyBlogs(newBlogs);
        foreach (var blog in newBlogs)
        {
            Assert.IsType<Blog>(blog);
        }

        var options = new JsonSerializerOptions { ReferenceHandler = ReferenceHandler.Preserve, WriteIndented = true };

        serialized = JsonSerializer.Serialize(blogs, options);

        Assert.Equal(SerializedBlogs2, serialized, ignoreLineEndingDifferences: true);

        newBlogs = JsonSerializer.Deserialize<List<Blog>>(serialized, options);
        Assert.IsType<List<Blog>>(newBlogs);

        foreach (var blog in newBlogs)
        {
            Assert.IsType<Blog>(blog);
        }

        VerifyBlogs(newBlogs);

Review comment (refactor):
Remove this extra blank line to maintain consistent formatting.
```suggestion

```

Code after:
        context.ChangeTracker.LazyLoadingEnabled = false;

        Assert.Equal(2, parent.Children!.Count());
        Assert.All(parent.Children!.Select(e => e.Parent), c => Assert.Same(parent, c));

        Assert.Equal(state == EntityState.Detached ? 0 : 3, context.ChangeTracker.Entries().Count());
    }

    [ConditionalFact]
    public virtual void Can_serialize_proxies_to_JSON()
    {
        using var context = CreateContext(lazyLoadingEnabled: true);

        var blogs = context.Set<Blog>().OrderBy(e => e.Id).ToList();

        VerifyBlogs(blogs);
        foreach (var blog in blogs)
        {
            Assert.IsNotType<Blog>(blog);
        }

        var serialized = JsonConvert.SerializeObject(
            blogs,
            new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore, Formatting = Formatting.Indented });

        Assert.Equal(SerializedBlogs1, serialized, ignoreLineEndingDifferences: true);

        var newBlogs = JsonConvert.DeserializeObject<List<Blog>>(serialized)!;

        VerifyBlogs(newBlogs);
        foreach (var blog in newBlogs)
        {
            Assert.IsType<Blog>(blog);
        }

        var options = new JsonSerializerOptions { ReferenceHandler = ReferenceHandler.Preserve, WriteIndented = true };

        serialized = JsonSerializer.Serialize(blogs, options);

        Assert.Equal(SerializedBlogs2, serialized, ignoreLineEndingDifferences: true);

        newBlogs = JsonSerializer.Deserialize<List<Blog>>(serialized, options);
        Assert.IsType<List<Blog>>(newBlogs);

        foreach (var blog in newBlogs)
        {
            Assert.IsType<Blog>(blog);
        }

        VerifyBlogs(newBlogs);
    }