public void ResolveResultSingle_throws_on_failures() { var expected = new ResolveFailure(Mock.Of<IResolveBuilder>(), "4242"); var result = new ResolveResultSingle<Int32>() { Results = new[] { 42 }, ResolveFailures = new[] { expected } }; var exc = Assert.Throws<ResolveFailedException>(() => result.Value); var rf = Assert.Single(exc.Failures); Assert.Same(expected, rf); }
public void ResolveResultSingleOrDefault_ignores_failures() { var expected = new ResolveFailure(Mock.Of<IResolveBuilder>(), "4242"); var result = new ResolveResultSingleOrDefault<Int32>() { Results = new[] { 42 }, ResolveFailures = new[] { expected } }; Assert.Equal(42, result.Value); Assert.True(result.HasValue); }