Skip to content

Commit

Permalink
Update PackageManagerViewExtensionTests.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
pinzart90 committed Apr 23, 2024
1 parent 3c37ceb commit 068adc2
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public void TestCrashInPackage()
var pkgDir = Path.Combine(PackagesDirectory, "SampleViewExtension_Crash");

var currentDynamoModel = ViewModel.Model;

var loader = currentDynamoModel.GetPackageManagerExtension().PackageLoader;

var pkg = loader.ScanPackageDirectory(pkgDir);
Expand All @@ -340,9 +340,15 @@ void DynamoConsoleLogger_LogErrorToDynamoConsole(string obj)

DynamoConsoleLogger.LogErrorToDynamoConsole += DynamoConsoleLogger_LogErrorToDynamoConsole;

loader.LoadPackages(new List<Package>() { pkg });

DispatcherUtil.DoEventsLoop(() => caughtExceptionFromPkg);
// Test live conditions of exception handling
using (Disposable.Create(() => { DynamoModel.IsTestMode = false; }, () => { DynamoModel.IsTestMode = true; }))
{
Assert.DoesNotThrow(() =>
{
loader.LoadPackages(new List<Package>() { pkg });
DispatcherUtil.DoEventsLoop(() => caughtExceptionFromPkg);
});
}

Assert.AreEqual(1, count);
Assert.IsTrue(caughtExceptionFromPkg);
Expand Down

0 comments on commit 068adc2

Please sign in to comment.