Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<PackageVersion Include="BenchmarkDotNet" Version="0.14.0" />
<PackageVersion Include="Bullseye" Version="4.1.1" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="FakeItEasy" Version="6.2.1" />
<PackageVersion Include="FluentAssertions" Version="4.19.2" />
<PackageVersion Include="FakeItEasy" Version="8.3.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.1" />
<PackageVersion Include="FSharp.Core" Version="8.0.400" />
<PackageVersion Include="Microsoft.AspNet.WebApi.Client" Version="6.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.4.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="Nullable" Version="1.3.1" />
<PackageVersion Include="ObjectLayoutInspector" Version="0.1.2" />
<PackageVersion Include="SimpleExec" Version="12.0.0" />
Expand Down
9 changes: 5 additions & 4 deletions YamlDotNet.Test/Core/EmitterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ public void CompareOriginalAndEmittedText(string filename)
var emittedText = EmittedTextFrom(originalEvents);
var emittedEvents = ParsingEventsOf(emittedText);

emittedEvents.ShouldAllBeEquivalentTo(originalEvents,
opt => opt.Excluding(@event => @event.Start)
.Excluding(@event => @event.End)
.Excluding((ParsingEvent @event) => ((DocumentEnd)@event).IsImplicit));
emittedEvents.Should().BeEquivalentTo(originalEvents, opt => opt
.Excluding(@event => @event.Start)
.Excluding(@event => @event.End)
.Excluding(@event => ((DocumentEnd)@event).IsImplicit)
);
}

private IList<ParsingEvent> ParsingEventsOf(string text)
Expand Down
6 changes: 3 additions & 3 deletions YamlDotNet.Test/Core/InsertionQueueTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public void ShouldThrowExceptionWhenDequeuingEmptyContainer()

Action action = () => queue.Dequeue();

action.ShouldThrow<InvalidOperationException>();
action.Should().Throw<InvalidOperationException>();
}

[Fact]
Expand All @@ -279,7 +279,7 @@ public void ShouldThrowExceptionWhenDequeuingContainerThatBecomesEmpty()
queue.Dequeue();
Action action = () => queue.Dequeue();

action.ShouldThrow<InvalidOperationException>();
action.Should().Throw<InvalidOperationException>();
}

[Fact]
Expand Down Expand Up @@ -314,7 +314,7 @@ public void ShouldThrowExceptionWhenDequeuingAfterInserting()
PerformTimes(2, queue.Dequeue);
Action action = () => queue.Dequeue();

action.ShouldThrow<InvalidOperationException>();
action.Should().Throw<InvalidOperationException>();
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion YamlDotNet.Test/Core/LookAheadBufferTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public void ShouldThrowWhenSkippingBeyondCurrentBuffer()
buffer.Peek(3);
Action action = () => buffer.Skip(5);

action.ShouldThrow<ArgumentOutOfRangeException>();
action.Should().Throw<ArgumentOutOfRangeException>();
}

private static LookAheadBuffer CreateBuffer(TextReader reader, int capacity)
Expand Down
3 changes: 1 addition & 2 deletions YamlDotNet.Test/RepresentationModel/YamlStreamTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.RepresentationModel;
using YamlDotNet.Serialization.Schemas;

namespace YamlDotNet.Test.RepresentationModel
{
Expand Down Expand Up @@ -57,7 +56,7 @@ public void AccessingAllNodesOnInfinitelyRecursiveDocumentThrows(string yaml)

var accessAllNodes = new Action(() => stream.Documents.Single().AllNodes.ToList());

accessAllNodes.ShouldThrow<MaximumRecursionLevelReachedException>("because the document is infinitely recursive.");
accessAllNodes.Should().Throw<MaximumRecursionLevelReachedException>("because the document is infinitely recursive.");
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@

using System;
using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using Xunit;
using YamlDotNet.Core;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

using System;
using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using Xunit;
using YamlDotNet.Core;
Expand All @@ -47,10 +46,10 @@ public void TypeDiscriminatingNodeDeserializer_ThrowsWhen_MaxDepthExceeded()

Action act = () => bufferedDeserializer.Deserialize<object>(KubernetesServiceYaml);
act
.ShouldThrow<YamlException>()
.Should().Throw<YamlException>()
.WithMessage("Failed to buffer yaml node")
.WithInnerException<ArgumentOutOfRangeException>()
.Where(e => e.InnerException.Message.Contains("Parser buffer exceeded max depth"));
.WithMessage("Parser buffer exceeded max depth*");
}

[Fact]
Expand All @@ -68,10 +67,10 @@ public void TypeDiscriminatingNodeDeserializer_ThrowsWhen_MaxLengthExceeded()

Action act = () => bufferedDeserializer.Deserialize<object>(KubernetesServiceYaml);
act
.ShouldThrow<YamlException>()
.Should().Throw<YamlException>()
.WithMessage("Failed to buffer yaml node")
.WithInnerException<ArgumentOutOfRangeException>()
.Where(e => e.InnerException.Message.Contains("Parser buffer exceeded max length"));
.WithMessage("Parser buffer exceeded max length*");
}

public const string KubernetesServiceYaml = @"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@

using System;
using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using Xunit;
using YamlDotNet.Core;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;

Expand Down
2 changes: 1 addition & 1 deletion YamlDotNet.Test/Serialization/DateOnlyConverterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void Given_Yaml_WithInvalidDateTimeFormat_WithDefaultParameter_ReadYaml_S

Action action = () => { converter.ReadYaml(parser, typeof(DateOnly), null); };

action.ShouldThrow<FormatException>();
action.Should().Throw<FormatException>();
}

/// <summary>
Expand Down
5 changes: 0 additions & 5 deletions YamlDotNet.Test/Serialization/DateTime8601ConverterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
// SOFTWARE.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FakeItEasy;
using Xunit;
using YamlDotNet.Core;
using YamlDotNet.Serialization;
Expand Down
2 changes: 1 addition & 1 deletion YamlDotNet.Test/Serialization/DateTimeConverterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void Given_Yaml_WithInvalidDateTimeFormat_WithDefaultParameters_ReadYaml_

Action action = () => { converter.ReadYaml(parser, typeof(DateTime), null); };

action.ShouldThrow<FormatException>();
action.Should().Throw<FormatException>();
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void InvalidFormatThrowsException()

Action action = () => { converter.ReadYaml(parser, typeof(DateTimeOffset), null); };

action.ShouldThrow<FormatException>();
action.Should().Throw<FormatException>();
}

[Fact]
Expand Down
12 changes: 6 additions & 6 deletions YamlDotNet.Test/Serialization/DeserializerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,14 @@ public void DeserializeWithDuplicateKeyChecking_YamlWithDuplicateKeys_ThrowsYaml
.Build();

Action act = () => sut.Deserialize<Person>(yaml);
act.ShouldThrow<YamlException>("Because there are duplicate name keys with concrete class");
act.Should().Throw<YamlException>("Because there are duplicate name keys with concrete class");
act = () => sut.Deserialize<IDictionary<object, object>>(yaml);
act.ShouldThrow<YamlException>("Because there are duplicate name keys with dictionary");
act.Should().Throw<YamlException>("Because there are duplicate name keys with dictionary");

var stream = Yaml.ReaderFrom("backreference.yaml");
var parser = new MergingParser(new Parser(stream));
act = () => sut.Deserialize<Dictionary<string, Dictionary<string, string>>>(parser);
act.ShouldThrow<YamlException>("Because there are duplicate name keys with merging parser");
act.Should().Throw<YamlException>("Because there are duplicate name keys with merging parser");
}

[Fact]
Expand All @@ -325,14 +325,14 @@ public void DeserializeWithoutDuplicateKeyChecking_YamlWithDuplicateKeys_DoesNot
.Build();

Action act = () => sut.Deserialize<Person>(yaml);
act.ShouldNotThrow<YamlException>("Because duplicate key checking is not enabled");
act.Should().NotThrow<YamlException>("Because duplicate key checking is not enabled");
act = () => sut.Deserialize<IDictionary<object, object>>(yaml);
act.ShouldNotThrow<YamlException>("Because duplicate key checking is not enabled");
act.Should().NotThrow<YamlException>("Because duplicate key checking is not enabled");

var stream = Yaml.ReaderFrom("backreference.yaml");
var parser = new MergingParser(new Parser(stream));
act = () => sut.Deserialize<Dictionary<string, Dictionary<string, string>>>(parser);
act.ShouldNotThrow<YamlException>("Because duplicate key checking is not enabled");
act.Should().NotThrow<YamlException>("Because duplicate key checking is not enabled");
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion YamlDotNet.Test/Serialization/HiddenPropertyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void TestDuplicate()
.Build();

Action action = () => { d.Deserialize<DuplicatePropertyDerived<string>>(yaml); };
action.ShouldThrow<YamlException>();
action.Should().Throw<YamlException>();
}
}
}
Loading