Skip to content

Commit d446f72

Browse files
committed
Fix tests after package update
1 parent 79283de commit d446f72

File tree

1 file changed

+101
-101
lines changed

1 file changed

+101
-101
lines changed
Lines changed: 101 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,101 @@
1-
using System;
2-
using FluentAssertions;
3-
using Xunit;
4-
using Xunit.Sdk;
5-
6-
namespace CSharpFunctionalExtensions.FluentAssertions.Tests;
7-
public class ResultTEAssertionTests
8-
{
9-
[Fact]
10-
public void WhenResultIsExpectedToBeSuccessItShouldBeSuccess()
11-
{
12-
string value = "value";
13-
var result = Result.Success<string, Exception>(value);
14-
15-
var action = () => result.Should().Succeed();
16-
17-
action.Should().NotThrow();
18-
result.Should().Succeed().Which.Should().Be(value);
19-
}
20-
21-
[Fact]
22-
public void WhenResultIsExpectedToBeSuccessWithValueItShouldBeSuccessWithValue()
23-
{
24-
string value = "value";
25-
var result = Result.Success<string, Exception>(value);
26-
27-
result.Should().SucceedWith(value);
28-
result.Should().SucceedWith(value).Which.Should().Be(value);
29-
}
30-
31-
[Fact]
32-
public void WhenResultIsExpectedToBeSuccessItShouldThrowWhenFailure()
33-
{
34-
var error = new Exception("error");
35-
var result = Result.Failure<string, Exception>(error);
36-
37-
var action = () => result.Should().Succeed();
38-
39-
action.Should().Throw<XunitException>().WithMessage(@$"Expected {nameof(result)} to succeed, but it failed with error ""System.Exception: error""");
40-
}
41-
42-
[Fact]
43-
public void WhenResultIsExpectedToBeSuccessWithValueItShouldThrowWhenSuccessWithDifferentValue()
44-
{
45-
string value = "value";
46-
var result = Result.Success<string, Exception>(value);
47-
48-
var action = () => result.Should().SucceedWith("some other value");
49-
50-
action.Should().Throw<XunitException>().WithMessage(@$"Expected {nameof(result)} value to be ""some other value"", but found ""value""");
51-
}
52-
53-
[Fact]
54-
public void WhenResultIsExpectedToBeFailureItShouldBeFailure()
55-
{
56-
var error = new Exception("error");
57-
var result = Result.Failure<string, Exception>(error);
58-
59-
var action = () => result.Should().Fail();
60-
var actionWith = () => result.Should().FailWith(error);
61-
62-
action.Should().NotThrow();
63-
actionWith.Should().NotThrow();
64-
result.Should().Fail().Which.Should().Be(error);
65-
result.Should().FailWith(error).Which.Should().Be(error);
66-
}
67-
68-
[Fact]
69-
public void WhenResultIsExpectedToBeFailureWithValueItShouldBeFailureWithValue()
70-
{
71-
var error = new Exception("error");
72-
var result = Result.Failure<string, Exception>(error);
73-
74-
result.Should().FailWith(error);
75-
}
76-
77-
[Fact]
78-
public void WhenResultIsExpectedToBeFailureWithValueItShouldThrowWhenFailureWithDifferenceValue()
79-
{
80-
var error = new Exception("error");
81-
var result = Result.Failure<string, Exception>(error);
82-
83-
var action = () => result.Should().FailWith(new Exception("Some other error"));
84-
85-
action.Should().Throw<XunitException>().WithMessage(@$"Expected {nameof(result)} error to be System.Exception with message ""Some other error"", but found System.Exception with message ""error""");
86-
}
87-
88-
[Fact]
89-
public void WhenResultIsExpectedToBeFailureItShouldThrowWhenSuccess()
90-
{
91-
string value = "value";
92-
var someError = new Exception("error");
93-
var result = Result.Success<string, Exception>(value);
94-
95-
var action = () => result.Should().Fail();
96-
var actionWith = () => result.Should().FailWith(someError);
97-
98-
action.Should().Throw<XunitException>().WithMessage(@$"Expected {nameof(result)} to fail, but it succeeded with value ""{value}""");
99-
actionWith.Should().Throw<XunitException>().WithMessage(@$"Expected {nameof(result)} to fail, but it succeeded");
100-
}
101-
}
1+
using System;
2+
using FluentAssertions;
3+
using Xunit;
4+
using Xunit.Sdk;
5+
6+
namespace CSharpFunctionalExtensions.FluentAssertions.Tests;
7+
public class ResultTEAssertionTests
8+
{
9+
[Fact]
10+
public void WhenResultIsExpectedToBeSuccessItShouldBeSuccess()
11+
{
12+
string value = "value";
13+
var result = Result.Success<string, Exception>(value);
14+
15+
var action = () => result.Should().Succeed();
16+
17+
action.Should().NotThrow();
18+
result.Should().Succeed().Which.Should().Be(value);
19+
}
20+
21+
[Fact]
22+
public void WhenResultIsExpectedToBeSuccessWithValueItShouldBeSuccessWithValue()
23+
{
24+
string value = "value";
25+
var result = Result.Success<string, Exception>(value);
26+
27+
result.Should().SucceedWith(value);
28+
result.Should().SucceedWith(value).Which.Should().Be(value);
29+
}
30+
31+
[Fact]
32+
public void WhenResultIsExpectedToBeSuccessItShouldThrowWhenFailure()
33+
{
34+
var error = new Exception("error");
35+
var result = Result.Failure<string, Exception>(error);
36+
37+
var action = () => result.Should().Succeed();
38+
39+
action.Should().Throw<XunitException>().WithMessage(@$"Expected {nameof(result)} to succeed, but it failed with error ""System.Exception: error""");
40+
}
41+
42+
[Fact]
43+
public void WhenResultIsExpectedToBeSuccessWithValueItShouldThrowWhenSuccessWithDifferentValue()
44+
{
45+
string value = "value";
46+
var result = Result.Success<string, Exception>(value);
47+
48+
var action = () => result.Should().SucceedWith("some other value");
49+
50+
action.Should().Throw<XunitException>().WithMessage(@$"Expected {nameof(result)} value to be ""some other value"", but found ""value""");
51+
}
52+
53+
[Fact]
54+
public void WhenResultIsExpectedToBeFailureItShouldBeFailure()
55+
{
56+
var error = new Exception("error");
57+
var result = Result.Failure<string, Exception>(error);
58+
59+
var action = () => result.Should().Fail();
60+
var actionWith = () => result.Should().FailWith(error);
61+
62+
action.Should().NotThrow();
63+
actionWith.Should().NotThrow();
64+
result.Should().Fail().Which.Should().Be(error);
65+
result.Should().FailWith(error).Which.Should().Be(error);
66+
}
67+
68+
[Fact]
69+
public void WhenResultIsExpectedToBeFailureWithValueItShouldBeFailureWithValue()
70+
{
71+
var error = new Exception("error");
72+
var result = Result.Failure<string, Exception>(error);
73+
74+
result.Should().FailWith(error);
75+
}
76+
77+
[Fact]
78+
public void WhenResultIsExpectedToBeFailureWithValueItShouldThrowWhenFailureWithDifferenceValue()
79+
{
80+
var error = new Exception("error");
81+
var result = Result.Failure<string, Exception>(error);
82+
83+
var action = () => result.Should().FailWith(new Exception("Some other error"));
84+
85+
action.Should().Throw<XunitException>().WithMessage(@$"Expected {nameof(result)} error to be System.Exception: Some other error, but found System.Exception: error");
86+
}
87+
88+
[Fact]
89+
public void WhenResultIsExpectedToBeFailureItShouldThrowWhenSuccess()
90+
{
91+
string value = "value";
92+
var someError = new Exception("error");
93+
var result = Result.Success<string, Exception>(value);
94+
95+
var action = () => result.Should().Fail();
96+
var actionWith = () => result.Should().FailWith(someError);
97+
98+
action.Should().Throw<XunitException>().WithMessage(@$"Expected {nameof(result)} to fail, but it succeeded with value ""{value}""");
99+
actionWith.Should().Throw<XunitException>().WithMessage(@$"Expected {nameof(result)} to fail, but it succeeded");
100+
}
101+
}

0 commit comments

Comments
 (0)