Skip to content

Commit e16c6ca

Browse files
committed
Updated FluentAssertions
1 parent 571d4d9 commit e16c6ca

8 files changed

Lines changed: 84 additions & 84 deletions

src/UnitTests/Bindings/ServiceBindingDeferredFacts.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public async Task BindUnchanged()
7878
}
7979

8080
[Fact]
81-
public void BindConflict()
81+
public async Task BindConflict()
8282
{
8383
var request = new ServiceBindingRequest
8484
{
@@ -88,9 +88,9 @@ public void BindConflict()
8888

8989
Mock.Setup(x => x.BindAsync(new("123", "456"), request))
9090
.Throws<ConflictException>();
91-
Client.ServiceInstancesDeferred["123"].ServiceBindings["456"]
92-
.Awaiting(x => x.BindAsync(request))
93-
.Should().Throw<ConflictException>();
91+
await Client.ServiceInstancesDeferred["123"].ServiceBindings["456"]
92+
.Awaiting(x => x.BindAsync(request))
93+
.Should().ThrowAsync<ConflictException>();
9494
}
9595

9696
[Fact]
@@ -119,13 +119,13 @@ public async Task UnbindCompleted()
119119
}
120120

121121
[Fact]
122-
public void UnbindGone()
122+
public async Task UnbindGone()
123123
{
124124
Mock.Setup(x => x.UnbindAsync(new("123", "456"), "abc", "xyz"))
125125
.Throws<GoneException>();
126-
Client.ServiceInstancesDeferred["123"].ServiceBindings["456"]
127-
.Awaiting(x => x.UnbindAsync("abc", "xyz"))
128-
.Should().Throw<GoneException>();
126+
await Client.ServiceInstancesDeferred["123"].ServiceBindings["456"]
127+
.Awaiting(x => x.UnbindAsync("abc", "xyz"))
128+
.Should().ThrowAsync<GoneException>();
129129
}
130130

131131
[Fact]
@@ -143,13 +143,13 @@ public async Task GetLastOperation()
143143
}
144144

145145
[Fact]
146-
public void GetLastOperationGone()
146+
public async Task GetLastOperationGone()
147147
{
148148
Mock.Setup(x => x.GetLastOperationAsync(new("123", "456"), "abc", "xyz", "my operation"))
149149
.Throws(new GoneException("custom message"));
150-
Client.ServiceInstancesDeferred["123"].ServiceBindings["456"].LastOperation("abc", "xyz", "my operation")
151-
.Awaiting(x => x.ReadAsync())
152-
.Should().Throw<GoneException>().WithMessage("custom message");
150+
await Client.ServiceInstancesDeferred["123"].ServiceBindings["456"].LastOperation("abc", "xyz", "my operation")
151+
.Awaiting(x => x.ReadAsync())
152+
.Should().ThrowAsync<GoneException>().WithMessage("custom message");
153153
}
154154
}
155155
}

src/UnitTests/Bindings/ServiceBindingPollingFacts.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public async Task BindCompleted()
7171
}
7272

7373
[Fact]
74-
public void BindConflict()
74+
public async Task BindConflict()
7575
{
7676
var request = new ServiceBindingRequest
7777
{
@@ -81,13 +81,13 @@ public void BindConflict()
8181

8282
Mock.Setup(x => x.BindAsync(new("123", "456"), request))
8383
.Throws<ConflictException>();
84-
Client.ServiceInstancesPolling["123"].ServiceBindings["456"]
85-
.Awaiting(x => x.BindAsync(request))
86-
.Should().Throw<ConflictException>();
84+
await Client.ServiceInstancesPolling["123"].ServiceBindings["456"]
85+
.Awaiting(x => x.BindAsync(request))
86+
.Should().ThrowAsync<ConflictException>();
8787
}
8888

8989
[Fact]
90-
public void BindAsyncError()
90+
public async Task BindAsyncError()
9191
{
9292
var request = new ServiceBindingRequest
9393
{
@@ -108,9 +108,9 @@ public void BindAsyncError()
108108
.ReturnsAsync(response);
109109
Mock.Setup(x => x.GetLastOperationAsync(new("123", "456"), "abc", "xyz", "my operation"))
110110
.ReturnsAsync(operation);
111-
Client.ServiceInstancesPolling["123"].ServiceBindings["456"]
112-
.Awaiting(x => x.BindAsync(request))
113-
.Should().Throw<BrokerException>().WithMessage("custom message");
111+
await Client.ServiceInstancesPolling["123"].ServiceBindings["456"]
112+
.Awaiting(x => x.BindAsync(request))
113+
.Should().ThrowAsync<BrokerException>().WithMessage("custom message");
114114
}
115115

116116
[Fact]
@@ -144,17 +144,17 @@ public async Task UnbindCompleted()
144144
}
145145

146146
[Fact]
147-
public void UnbindGone()
147+
public async Task UnbindGone()
148148
{
149149
Mock.Setup(x => x.UnbindAsync(new("123", "456"), "abc", "xyz"))
150150
.Throws<GoneException>();
151-
Client.ServiceInstancesPolling["123"].ServiceBindings["456"]
152-
.Awaiting(x => x.UnbindAsync("abc", "xyz"))
153-
.Should().Throw<GoneException>();
151+
await Client.ServiceInstancesPolling["123"].ServiceBindings["456"]
152+
.Awaiting(x => x.UnbindAsync("abc", "xyz"))
153+
.Should().ThrowAsync<GoneException>();
154154
}
155155

156156
[Fact]
157-
public void UnbindAsyncGone()
157+
public async Task UnbindAsyncGone()
158158
{
159159
var response = new ServiceInstanceAsyncOperation
160160
{
@@ -165,9 +165,9 @@ public void UnbindAsyncGone()
165165
.ReturnsAsync(response);
166166
Mock.Setup(x => x.GetLastOperationAsync(new("123", "456"), "abc", "xyz", "my operation"))
167167
.Throws<GoneException>();
168-
Client.ServiceInstancesPolling["123"].ServiceBindings["456"]
169-
.Awaiting(x => x.UnbindAsync("abc", "xyz"))
170-
.Should().Throw<GoneException>();
168+
await Client.ServiceInstancesPolling["123"].ServiceBindings["456"]
169+
.Awaiting(x => x.UnbindAsync("abc", "xyz"))
170+
.Should().ThrowAsync<GoneException>();
171171
}
172172
}
173173
}

src/UnitTests/Bindings/ServiceBindingeBlockingFacts.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public async Task BindUnchanged()
5757
}
5858

5959
[Fact]
60-
public void BindConflict()
60+
public async Task BindConflict()
6161
{
6262
var request = new ServiceBindingRequest
6363
{
@@ -67,9 +67,9 @@ public void BindConflict()
6767

6868
Mock.Setup(x => x.BindAsync(new("123", "456"), request))
6969
.Throws<ConflictException>();
70-
Client.ServiceInstancesBlocking["123"].ServiceBindings["456"]
71-
.Awaiting(x => x.BindAsync(request))
72-
.Should().Throw<ConflictException>();
70+
await Client.ServiceInstancesBlocking["123"].ServiceBindings["456"]
71+
.Awaiting(x => x.BindAsync(request))
72+
.Should().ThrowAsync<ConflictException>();
7373
}
7474

7575
[Fact]
@@ -92,13 +92,13 @@ public async Task UnbindBody()
9292
}
9393

9494
[Fact]
95-
public void UnbindGone()
95+
public async Task UnbindGone()
9696
{
9797
Mock.Setup(x => x.UnbindAsync(new("123", "456"), "abc", "xyz"))
9898
.Throws<GoneException>();
99-
Client.ServiceInstancesBlocking["123"].ServiceBindings["456"]
100-
.Awaiting(x => x.UnbindAsync("abc", "xyz"))
101-
.Should().Throw<GoneException>();
99+
await Client.ServiceInstancesBlocking["123"].ServiceBindings["456"]
100+
.Awaiting(x => x.UnbindAsync("abc", "xyz"))
101+
.Should().ThrowAsync<GoneException>();
102102
}
103103
}
104104
}

src/UnitTests/Instances/HeaderFacts.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ namespace OpenServiceBroker.Instances
1010
public class HeaderFacts : FactsBase<IServiceInstanceBlocking>
1111
{
1212
[Fact]
13-
public void WrongMajorVersion()
13+
public async Task WrongMajorVersion()
1414
{
1515
Client.SetApiVersion(new(1, 0));
16-
Client.ServiceInstancesBlocking["123"]
17-
.Awaiting(x => x.FetchAsync())
18-
.Should().Throw<ApiVersionNotSupportedException>();
16+
await Client.ServiceInstancesBlocking["123"]
17+
.Awaiting(x => x.FetchAsync())
18+
.Should().ThrowAsync<ApiVersionNotSupportedException>();
1919
}
2020

2121
[Fact]
22-
public void TooNewMinorVersion()
22+
public async Task TooNewMinorVersion()
2323
{
2424
Client.SetApiVersion(new(ServiceInstancesController.SupportedApiVersion.Major, ServiceInstancesController.SupportedApiVersion.Minor + 1));
25-
Client.ServiceInstancesBlocking["123"]
26-
.Awaiting(x => x.FetchAsync())
27-
.Should().Throw<ApiVersionNotSupportedException>();
25+
await Client.ServiceInstancesBlocking["123"]
26+
.Awaiting(x => x.FetchAsync())
27+
.Should().ThrowAsync<ApiVersionNotSupportedException>();
2828
}
2929

3030
[Fact]

src/UnitTests/Instances/ServiceInstanceBlockingFacts.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public async Task ProvisionUnchanged()
7171
}
7272

7373
[Fact]
74-
public void ProvisionConflict()
74+
public async Task ProvisionConflict()
7575
{
7676
var request = new ServiceInstanceProvisionRequest
7777
{
@@ -83,9 +83,9 @@ public void ProvisionConflict()
8383

8484
Mock.Setup((x => x.ProvisionAsync(new("123"), request)))
8585
.Throws(new ConflictException("custom message"));
86-
Client.ServiceInstancesBlocking["123"]
87-
.Awaiting(x => x.ProvisionAsync(request))
88-
.Should().Throw<ConflictException>().WithMessage("custom message");
86+
await Client.ServiceInstancesBlocking["123"]
87+
.Awaiting(x => x.ProvisionAsync(request))
88+
.Should().ThrowAsync<ConflictException>().WithMessage("custom message");
8989
}
9090

9191
[Fact]
@@ -115,7 +115,7 @@ public async Task UpdateBody()
115115
.Returns(Task.CompletedTask);
116116

117117
var result = await Client.HttpClient.PatchAsync(Client.ServiceInstancesBlocking["123"].Uri, request, Client.Serializer);
118-
result.StatusCode.Should().BeEquivalentTo(HttpStatusCode.OK);
118+
result.StatusCode.Should().Be(HttpStatusCode.OK);
119119
string resultString = await result.Content.ReadAsStringAsync();
120120
resultString.Should().Be("{}");
121121
}
@@ -135,19 +135,19 @@ public async Task DeprovisionBody()
135135
.Returns(Task.CompletedTask);
136136

137137
var result = await Client.HttpClient.DeleteAsync(Client.ServiceInstancesBlocking["123"].Uri.Join("?service_id=abc&plan_id=xyz"));
138-
result.StatusCode.Should().BeEquivalentTo(HttpStatusCode.OK);
138+
result.StatusCode.Should().Be(HttpStatusCode.OK);
139139
string resultString = await result.Content.ReadAsStringAsync();
140140
resultString.Should().Be("{}");
141141
}
142142

143143
[Fact]
144-
public void DeprovisionGone()
144+
public async Task DeprovisionGone()
145145
{
146146
Mock.Setup((x => x.DeprovisionAsync(new("123"), "abc", "xyz")))
147-
.Throws<GoneException>();
148-
Client.ServiceInstancesBlocking["123"]
149-
.Awaiting(x => x.DeprovisionAsync("abc", "xyz"))
150-
.Should().Throw<GoneException>();
147+
.Throws<GoneException>();
148+
await Client.ServiceInstancesBlocking["123"]
149+
.Awaiting(x => x.DeprovisionAsync("abc", "xyz"))
150+
.Should().ThrowAsync<GoneException>();
151151
}
152152
}
153153
}

src/UnitTests/Instances/ServiceInstanceDeferredFacts.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public async Task ProvisionUnchanged()
9090
}
9191

9292
[Fact]
93-
public void ProvisionConflict()
93+
public async Task ProvisionConflict()
9494
{
9595
var request = new ServiceInstanceProvisionRequest
9696
{
@@ -102,9 +102,9 @@ public void ProvisionConflict()
102102

103103
Mock.Setup((x => x.ProvisionAsync(new("123"), request)))
104104
.Throws(new ConflictException("custom message"));
105-
Client.ServiceInstancesDeferred["123"]
106-
.Awaiting(x => x.ProvisionAsync(request))
107-
.Should().Throw<ConflictException>().WithMessage("custom message");
105+
await Client.ServiceInstancesDeferred["123"]
106+
.Awaiting(x => x.ProvisionAsync(request))
107+
.Should().ThrowAsync<ConflictException>().WithMessage("custom message");
108108
}
109109

110110
[Fact]
@@ -169,13 +169,13 @@ public async Task DeprovisionCompleted()
169169
}
170170

171171
[Fact]
172-
public void DeprovisionGone()
172+
public async Task DeprovisionGone()
173173
{
174174
Mock.Setup((x => x.DeprovisionAsync(new("123"), "abc", "xyz")))
175175
.Throws<GoneException>();
176-
Client.ServiceInstancesDeferred["123"]
177-
.Awaiting(x => x.DeprovisionAsync("abc", "xyz"))
178-
.Should().Throw<GoneException>();
176+
await Client.ServiceInstancesDeferred["123"]
177+
.Awaiting(x => x.DeprovisionAsync("abc", "xyz"))
178+
.Should().ThrowAsync<GoneException>();
179179
}
180180

181181
[Fact]
@@ -193,13 +193,13 @@ public async Task GetLastOperation()
193193
}
194194

195195
[Fact]
196-
public void GetLastOperationGone()
196+
public async Task GetLastOperationGone()
197197
{
198198
Mock.Setup((x => x.GetLastOperationAsync(new("123"), "abc", "xyz", "my operation")))
199199
.Throws(new GoneException("custom message"));
200-
Client.ServiceInstancesDeferred["123"].LastOperation("abc", "xyz", "my operation")
201-
.Awaiting(x => x.ReadAsync())
202-
.Should().Throw<GoneException>().WithMessage("custom message");
200+
await Client.ServiceInstancesDeferred["123"].LastOperation("abc", "xyz", "my operation")
201+
.Awaiting(x => x.ReadAsync())
202+
.Should().ThrowAsync<GoneException>().WithMessage("custom message");
203203
}
204204
}
205205
}

src/UnitTests/Instances/ServiceInstancePollingFacts.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public async Task ProvisionCompleted()
6565
}
6666

6767
[Fact]
68-
public void ProvisionConflict()
68+
public async Task ProvisionConflict()
6969
{
7070
var request = new ServiceInstanceProvisionRequest
7171
{
@@ -77,13 +77,13 @@ public void ProvisionConflict()
7777

7878
Mock.Setup((x => x.ProvisionAsync(new("123"), request)))
7979
.Throws(new ConflictException("custom message"));
80-
Client.ServiceInstancesPolling["123"]
81-
.Awaiting(x => x.ProvisionAsync(request))
82-
.Should().Throw<ConflictException>().WithMessage("custom message");
80+
await Client.ServiceInstancesPolling["123"]
81+
.Awaiting(x => x.ProvisionAsync(request))
82+
.Should().ThrowAsync<ConflictException>().WithMessage("custom message");
8383
}
8484

8585
[Fact]
86-
public void ProvisionAsyncError()
86+
public async Task ProvisionAsyncError()
8787
{
8888
var request = new ServiceInstanceProvisionRequest
8989
{
@@ -106,9 +106,9 @@ public void ProvisionAsyncError()
106106
.ReturnsAsync(response);
107107
Mock.Setup(x => x.GetLastOperationAsync(new("123"), "abc", "xyz", "my operation"))
108108
.ReturnsAsync(operation);
109-
Client.ServiceInstancesPolling["123"]
110-
.Awaiting(x => x.ProvisionAsync(request))
111-
.Should().Throw<BrokerException>().WithMessage("custom message");
109+
await Client.ServiceInstancesPolling["123"]
110+
.Awaiting(x => x.ProvisionAsync(request))
111+
.Should().ThrowAsync<BrokerException>().WithMessage("custom message");
112112
}
113113

114114
[Fact]
@@ -182,17 +182,17 @@ public async Task DeprovisionCompleted()
182182
}
183183

184184
[Fact]
185-
public void DeprovisionGone()
185+
public async Task DeprovisionGone()
186186
{
187187
Mock.Setup((x => x.DeprovisionAsync(new("123"), "abc", "xyz")))
188188
.Throws<GoneException>();
189-
Client.ServiceInstancesPolling["123"]
190-
.Awaiting(x => x.DeprovisionAsync("abc", "xyz"))
191-
.Should().Throw<GoneException>();
189+
await Client.ServiceInstancesPolling["123"]
190+
.Awaiting(x => x.DeprovisionAsync("abc", "xyz"))
191+
.Should().ThrowAsync<GoneException>();
192192
}
193193

194194
[Fact]
195-
public void DeprovisionAsyncGone()
195+
public async Task DeprovisionAsyncGone()
196196
{
197197
var response = new ServiceInstanceAsyncOperation
198198
{
@@ -203,9 +203,9 @@ public void DeprovisionAsyncGone()
203203
.ReturnsAsync(response);
204204
Mock.Setup((x => x.GetLastOperationAsync(new("123"), "abc", "xyz", "my operation")))
205205
.Throws<GoneException>();
206-
Client.ServiceInstancesPolling["123"]
207-
.Awaiting(x => x.DeprovisionAsync("abc", "xyz"))
208-
.Should().Throw<GoneException>();
206+
await Client.ServiceInstancesPolling["123"]
207+
.Awaiting(x => x.DeprovisionAsync("abc", "xyz"))
208+
.Should().ThrowAsync<GoneException>();
209209
}
210210
}
211211
}

0 commit comments

Comments
 (0)