Skip to content

Commit

Permalink
modifying exception check, using Assert.Throws instead of try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
ggnaegi committed Oct 21, 2023
1 parent 3881bcc commit 1a73cd6
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions test/Ocelot.AcceptanceTests/CannotStartOcelotTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,8 @@ public void should_throw_exception_if_cannot_start()
},
};

Exception exception = null;
_steps.GivenThereIsAConfiguration(invalidConfig);
try
{
_steps.GivenOcelotIsRunning();
}
catch (Exception ex)
{
exception = ex;
}
var exception = Assert.Throws<AggregateException>(() => _steps.GivenOcelotIsRunning());

exception.ShouldNotBeNull();
exception.Message.ShouldBe("One or more errors occurred. (Unable to start Ocelot, errors are: Downstream Path Template test doesnt start with forward slash,Upstream Path Template api doesnt start with forward slash,When not using service discovery DownstreamHostAndPorts must be set and not empty or Ocelot cannot find your service!)");
Expand Down

0 comments on commit 1a73cd6

Please sign in to comment.