Skip to content

Commit 2648bfd

Browse files
author
喻斌
committed
unit test sync
1 parent 67a36fe commit 2648bfd

File tree

2 files changed

+60
-5
lines changed

2 files changed

+60
-5
lines changed

src/CatLib.Framework.Tests/Routing/RouterExceptionTests.cs

+48-4
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,18 @@ public void TestNestedNoSchemeThrowException()
123123

124124
ExceptionAssert.Throws<NotFoundRouteException>(() =>
125125
{
126-
router.Dispatch("ui://helloworld/call");
126+
try
127+
{
128+
router.Dispatch("ui://helloworld/call");
129+
}
130+
catch (Exception ex)
131+
{
132+
while (ex.InnerException != null)
133+
{
134+
ex = ex.InnerException;
135+
}
136+
throw ex;
137+
}
127138
});
128139

129140
Assert.AreEqual(1, throwNotFound);
@@ -155,7 +166,18 @@ public void TestSimpleException()
155166

156167
ExceptionAssert.Throws<ArgumentNullException>(() =>
157168
{
158-
router.Dispatch("ui://helloworld/call");
169+
try
170+
{
171+
router.Dispatch("ui://helloworld/call");
172+
}
173+
catch (Exception ex)
174+
{
175+
while (ex.InnerException != null)
176+
{
177+
ex = ex.InnerException;
178+
}
179+
throw ex;
180+
}
159181
});
160182

161183
Assert.AreEqual(1, throwError);
@@ -206,7 +228,18 @@ public void TestNestedException()
206228

207229
ExceptionAssert.Throws<ArgumentNullException>(() =>
208230
{
209-
router.Dispatch("ui://helloworld/call");
231+
try
232+
{
233+
router.Dispatch("ui://helloworld/call");
234+
}
235+
catch (Exception ex)
236+
{
237+
while (ex.InnerException != null)
238+
{
239+
ex = ex.InnerException;
240+
}
241+
throw ex;
242+
}
210243
});
211244

212245
Assert.AreEqual(12, throwError);
@@ -287,7 +320,18 @@ public void TestNestedNotFoundRouteTest()
287320
{
288321
ExceptionAssert.Throws<NotFoundRouteException>(() =>
289322
{
290-
router.Dispatch("ui://helloworld/call2");
323+
try
324+
{
325+
router.Dispatch("ui://helloworld/call2");
326+
}
327+
catch (Exception ex)
328+
{
329+
while (ex.InnerException != null)
330+
{
331+
ex = ex.InnerException;
332+
}
333+
throw ex;
334+
}
291335
});
292336
res.SetContext("helloworld");
293337
});

src/CatLib.Framework.Tests/Routing/RouterTests.cs

+12-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,18 @@ public void RoutingCircularDependencyCall()
419419

420420
ExceptionAssert.Throws<RuntimeException>(() =>
421421
{
422-
router.Dispatch("lambda://call/RoutingCircularDependencyCall-1");
422+
try
423+
{
424+
router.Dispatch("lambda://call/RoutingCircularDependencyCall-1");
425+
}
426+
catch (Exception ex)
427+
{
428+
while (ex.InnerException != null)
429+
{
430+
ex = ex.InnerException;
431+
}
432+
throw ex;
433+
}
423434
});
424435
}
425436

0 commit comments

Comments
 (0)