Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 8a56aae6 authored by Harald Martini's avatar Harald Martini
Browse files

Added Teardown method to backingstorage tests

parent 4bcc2148
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ namespace VECTO3GUI2020.ViewModel.Implementation.Common
public bool UnsavedChanges
{
get => _unsavedChanges.Count != 0;
get => (_savedValues == null) || (_unsavedChanges.Count != 0);
}
private void ResetUnsavedChanges()
......
......@@ -73,6 +73,18 @@ namespace Vecto3GUI2020Test.HelperTests
_testVm.BackingStorage.PropertyChanged += BackingStorage_PropertyChanged;
}
[TearDown]
public void TearDown()
{
_unsavedChangesNotified = false;
_currentValues = null;
_unsavedChanges = null;
_savedValues = null;
_testVm.BackingStorage.PropertyChanged -= BackingStorage_PropertyChanged;
_testVm = null;
}
private void BackingStorage_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
switch (e.PropertyName) {
......@@ -158,6 +170,13 @@ namespace Vecto3GUI2020Test.HelperTests
Assert.IsFalse(_testVm.BackingStorage.UnsavedChanges);
}
[Test]
public void UnsavedTrueBeforeFirstSave()
{
Assert.IsTrue(_testVm.BackingStorage.UnsavedChanges);
_testVm.BackingStorage.SaveChanges();
Assert.IsFalse(_testVm.BackingStorage.UnsavedChanges);
}
[Test]
public void SavedChangesNotModified()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment