refactor: Remove unneeded FileName property

json-serializing-nullable-fields-issue
Robert Dailey 9 months ago
parent 1aaa2747b8
commit f905b251dc

@ -29,8 +29,7 @@ public class CustomFormatLoader : ICustomFormatLoader
return cf.Obj with return cf.Obj with
{ {
Category = matchingCategory?.CategoryName, Category = matchingCategory?.CategoryName
FileName = cf.File.Name
}; };
})); }));
} }

@ -28,9 +28,6 @@ public record CustomFormatData
[JsonIgnore] [JsonIgnore]
public string? Category { get; init; } public string? Category { get; init; }
[JsonIgnore]
public string FileName { get; init; } = "";
[JsonProperty("trash_id")] [JsonProperty("trash_id")]
[JsonNoSerialize] [JsonNoSerialize]
public string TrashId { get; init; } = ""; public string TrashId { get; init; } = "";

@ -229,7 +229,6 @@ public class CustomFormatDataComparerTest
{ {
var a = new CustomFormatData var a = new CustomFormatData
{ {
FileName = "file1.json",
TrashId = "a", TrashId = "a",
TrashScores = {["default"] = 1}, TrashScores = {["default"] = 1},
Category = "one" Category = "one"
@ -237,7 +236,6 @@ public class CustomFormatDataComparerTest
var b = new CustomFormatData var b = new CustomFormatData
{ {
FileName = "file2.json",
TrashId = "b", TrashId = "b",
TrashScores = {["default"] = 2}, TrashScores = {["default"] = 2},
Category = "two" Category = "two"

@ -23,8 +23,8 @@ public class CustomFormatLoaderIntegrationTest : GuideIntegrationFixture
results.Should().BeEquivalentTo(new[] results.Should().BeEquivalentTo(new[]
{ {
NewCf.Data("first", "1") with {FileName = "first.json"}, NewCf.Data("first", "1"),
NewCf.Data("second", "2") with {FileName = "second.json"} NewCf.Data("second", "2")
}, o => o.Excluding(x => x.Type == typeof(JObject))); }, o => o.Excluding(x => x.Type == typeof(JObject)));
} }
} }

Loading…
Cancel
Save