Revise DeleteProfileWorksForGuest test
- Prevent null reference on SyncPrinterProfiles()
This commit is contained in:
parent
85b6dc1ac3
commit
4958defdeb
2 changed files with 7 additions and 11 deletions
|
|
@ -215,8 +215,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
// Notify listeners of a ProfileListChange event due to this printers removal
|
||||
ProfileManager.ProfilesListChanged.CallEvents(this, null);
|
||||
|
||||
// Force sync after marking for delete
|
||||
ApplicationController.SyncPrinterProfiles("SettingsHelpers.SetMarkedForDelete()", null);
|
||||
// Force sync after marking for delete if assigned
|
||||
ApplicationController.SyncPrinterProfiles?.Invoke("SettingsHelpers.SetMarkedForDelete()", null);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -242,27 +242,23 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
[Test]
|
||||
public async Task DeleteProfileWorksForGuest()
|
||||
{
|
||||
AutomationTest testToRun = (testRunner) =>
|
||||
await MatterControlUtilities.RunTest((testRunner) =>
|
||||
{
|
||||
testRunner.CloseSignInAndPrinterSelect();
|
||||
|
||||
// assert no profiles
|
||||
Assert.IsTrue(ProfileManager.Instance.ActiveProfiles.Count() == 0);
|
||||
Assert.AreEqual(0, ProfileManager.Instance.ActiveProfiles.Count());
|
||||
|
||||
MatterControlUtilities.AddAndSelectPrinter(testRunner, "Airwolf 3D", "HD");
|
||||
|
||||
// assert one profile
|
||||
Assert.IsTrue(ProfileManager.Instance.ActiveProfiles.Count() == 1);
|
||||
Assert.AreEqual(1, ProfileManager.Instance.ActiveProfiles.Count(), "One profile should exist after add");
|
||||
|
||||
MatterControlUtilities.DeleteSelectedPrinter(testRunner);
|
||||
|
||||
// assert no profiles
|
||||
Assert.IsTrue(ProfileManager.Instance.ActiveProfiles.Count() == 0);
|
||||
Assert.AreEqual(0, ProfileManager.Instance.ActiveProfiles.Count(), "No profiles should exist after delete");
|
||||
|
||||
return Task.FromResult(0);
|
||||
};
|
||||
|
||||
await MatterControlUtilities.RunTest(testToRun, overrideWidth: 1224, overrideHeight: 900);
|
||||
}, overrideWidth: 1224, overrideHeight: 900);
|
||||
}
|
||||
|
||||
private static void CheckAndUncheckSetting(AutomationRunner testRunner, string settingToChange, string checkBoxName, bool expected)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue