Skip to content

Commit

Permalink
fix xunit warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
brettfo committed Sep 7, 2024
1 parent 39893c9 commit 1884e78
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions src/IxMilia.Dxf.Test/EntityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -809,9 +809,9 @@ public void ReadLeaderWithTooFewVerticesTest()
{
// a leader with 0 vertices can't be created manually, but it can be read from disk
var leader = (DxfLeader)Entity("LEADER");
Assert.Equal(0, leader.Vertices.Count);
Assert.Empty(leader.Vertices);
leader.Vertices.Add(DxfPoint.Origin); // this is fine, even though we're still under the minimum
Assert.Equal(1, leader.Vertices.Count);
Assert.Single(leader.Vertices);
leader.Vertices.Add(DxfPoint.Origin); // now we're up to 2
Assert.Equal(2, leader.Vertices.Count);
leader.Vertices.Add(DxfPoint.Origin); // now we're up to 3
Expand Down Expand Up @@ -873,9 +873,9 @@ public void ReadPolylineWithTooFewVerticesTest()
{
// a polyline with 0 vertices can't be created manually, but it can be read from disk
var poly = (DxfPolyline)Entity("POLYLINE");
Assert.Equal(0, poly.Vertices.Count);
Assert.Empty(poly.Vertices);
poly.Vertices.Add(new DxfVertex()); // this is fine, even though we're still under the minimum
Assert.Equal(1, poly.Vertices.Count);
Assert.Single(poly.Vertices);
poly.Vertices.Add(new DxfVertex()); // now we're up to 2
Assert.Equal(2, poly.Vertices.Count);
poly.Vertices.Add(new DxfVertex()); // now we're up to 3
Expand Down Expand Up @@ -1717,7 +1717,7 @@ public void ReadBlockTest()
var first = file.Blocks[0];
Assert.Equal("block 1", first.Name);
Assert.Equal(new DxfPoint(1, 2, 3), first.BasePoint);
Assert.Equal(1, first.Entities.Count);
Assert.Single(first.Entities);
var entity = first.Entities.First();
Assert.Equal(DxfEntityType.Line, entity.EntityType);
var line = (DxfLine)entity;
Expand Down
4 changes: 2 additions & 2 deletions src/IxMilia.Dxf.Test/ObjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ public void DictionaryWithUnsupportedObjectTest()
(330, "42")
);
var dict = (DxfDictionary)file.Objects.Single();
Assert.Equal(1, dict.Keys.Count);
Assert.Single(dict.Keys);
Assert.Null(dict["key"]);
}

Expand Down Expand Up @@ -1612,7 +1612,7 @@ public void ReadXRecordWithMultipleXDataTest2()
(102, "VTR_0.000_0.000_1.000_1.000_CONTRAST"),
(142, 0.0)
);
Assert.Equal(0, xrecord.ExtensionDataGroups.Count);
Assert.Empty(xrecord.ExtensionDataGroups);
Assert.Equal(14, xrecord.DataPairs.Count);
Assert.Equal(102, xrecord.DataPairs[6].Code);
Assert.Equal("VTR_0.000_0.000_1.000_1.000_DEFAULTLIGHTING", xrecord.DataPairs[6].StringValue);
Expand Down
24 changes: 12 additions & 12 deletions src/IxMilia.Dxf.Test/ReaderWriterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public void ReadVersionSpecificClassTest_R13()
(0, "ENDSEC"),
(0, "EOF")
);
Assert.Equal(1, file.Classes.Count);
Assert.Single(file.Classes);

var cls = file.Classes.Single();
Assert.Equal("<class dxf name>", cls.ClassDxfRecordName);
Expand Down Expand Up @@ -197,7 +197,7 @@ public void ReadVersionSpecificClassTest_R14()
(0, "ENDSEC"),
(0, "EOF")
);
Assert.Equal(1, file.Classes.Count);
Assert.Single(file.Classes);

var cls = file.Classes.Single();
Assert.Equal("<class dxf name>", cls.ClassDxfRecordName);
Expand Down Expand Up @@ -1432,19 +1432,19 @@ public void EnsureParsedFileHasNoDefaultItems()
var file = Parse((0, "EOF"));

// all of these must be empty
Assert.Equal(0, file.ApplicationIds.Count);
Assert.Equal(0, file.BlockRecords.Count);
Assert.Equal(0, file.Blocks.Count);
Assert.Equal(0, file.Classes.Count);
Assert.Equal(0, file.DimensionStyles.Count);
Assert.Equal(0, file.Entities.Count);
Assert.Equal(0, file.Layers.Count);
Assert.Equal(0, file.LineTypes.Count);
Assert.Empty(file.ApplicationIds);
Assert.Empty(file.BlockRecords);
Assert.Empty(file.Blocks);
Assert.Empty(file.Classes);
Assert.Empty(file.DimensionStyles);
Assert.Empty(file.Entities);
Assert.Empty(file.Layers);
Assert.Empty(file.LineTypes);
Assert.Null(file.RawThumbnail);

// there is always a default dictionary
Assert.Single(file.NamedObjectDictionary);
Assert.Equal(1, file.Objects.Count);
Assert.Single(file.Objects);
Assert.True(ReferenceEquals(file.NamedObjectDictionary, file.Objects.Single()));
Assert.Equal("ACAD_GROUP", file.NamedObjectDictionary.Single().Key);
}
Expand Down Expand Up @@ -1617,7 +1617,7 @@ public void AddMissingLayersOnNormalizeTest()
file.Layers.Single(l => l.Name == "some-layer");

// ensure the `null` item wasn't added
Assert.Empty(file.Layers.Where(l => l.Name == null));
Assert.DoesNotContain(file.Layers, l => l.Name == null);
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion src/IxMilia.Dxf.Test/TextFileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public void SkipBomTest(int? codePage)
writer.Flush();
stream.Seek(0, SeekOrigin.Begin);
var file = DxfFile.Load(stream, encoding);
Assert.Equal(0, file.Layers.Count);
Assert.Empty(file.Layers);
}
}

Expand Down

0 comments on commit 1884e78

Please sign in to comment.