Skip to content

Commit 34619d4

Browse files
committed
Changed the async await to Task.FromException in TestAsyncConsumerExceptions.cs
1 parent c9553d2 commit 34619d4

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

projects/Unit/TestAsyncConsumerExceptions.cs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,15 @@ public ConsumerFailingOnDelivery(IModel model) : base(model)
114114
{
115115
}
116116

117-
public override async Task HandleBasicDeliver(string consumerTag,
117+
public override Task HandleBasicDeliver(string consumerTag,
118118
ulong deliveryTag,
119119
bool redelivered,
120120
string exchange,
121121
string routingKey,
122122
IBasicProperties properties,
123123
ReadOnlyMemory<byte> body)
124124
{
125-
await Task.Delay(0);
126-
throw new Exception("oops");
125+
return Task.FromException(new Exception("oops"));
127126
}
128127
}
129128

@@ -133,10 +132,9 @@ public ConsumerFailingOnCancel(IModel model) : base(model)
133132
{
134133
}
135134

136-
public override async Task HandleBasicCancel(string consumerTag)
135+
public override Task HandleBasicCancel(string consumerTag)
137136
{
138-
await Task.Delay(0);
139-
throw new Exception("oops");
137+
return Task.FromException(new Exception("oops"));
140138
}
141139
}
142140

@@ -146,10 +144,9 @@ public ConsumerFailingOnShutdown(IModel model) : base(model)
146144
{
147145
}
148146

149-
public override async Task HandleModelShutdown(object model, ShutdownEventArgs reason)
147+
public override Task HandleModelShutdown(object model, ShutdownEventArgs reason)
150148
{
151-
await Task.Delay(0);
152-
throw new Exception("oops");
149+
return Task.FromException(new Exception("oops"));
153150
}
154151
}
155152

@@ -159,10 +156,9 @@ public ConsumerFailingOnConsumeOk(IModel model) : base(model)
159156
{
160157
}
161158

162-
public override async Task HandleBasicConsumeOk(string consumerTag)
159+
public override Task HandleBasicConsumeOk(string consumerTag)
163160
{
164-
await Task.Delay(0);
165-
throw new Exception("oops");
161+
return Task.FromException(new Exception("oops"));
166162
}
167163
}
168164

@@ -172,10 +168,9 @@ public ConsumerFailingOnCancelOk(IModel model) : base(model)
172168
{
173169
}
174170

175-
public override async Task HandleBasicCancelOk(string consumerTag)
171+
public override Task HandleBasicCancelOk(string consumerTag)
176172
{
177-
await Task.Delay(0);
178-
throw new Exception("oops");
173+
return Task.FromException(new Exception("oops"));
179174
}
180175
}
181176
}

0 commit comments

Comments
 (0)