public void CloseYear_NonDefaultConfiguration_SettingsRestored() { var windowManager = Substitute.For <IWindowManager>(); var dialogs = Substitute.For <IDialogs>(); var fileSystem = Substitute.For <IFileSystem>(); var processApi = Substitute.For <IProcess>(); var settings = new Settings(); var sut = new ProjectData(settings, windowManager, dialogs, fileSystem, processApi); sut.Load(Samples.SampleProject); sut.Storage.Accounts.Last().Account.Add( new AccountDefinition { ID = 99999, Name = "C2", Type = AccountDefinitionType.Carryforward }); sut.Storage.Setup.Behavior.LastCarryForward = 99999; sut.Storage.Setup.Behavior.LastCarryForwardSpecified = true; sut.Storage.Setup.Behavior.OpeningTextPattern = OpeningTextOption.AccountName.ToString(); CloseYearViewModel invokedViewModel = null; windowManager .ShowDialog(Arg.Any <CloseYearViewModel>(), Arg.Any <object>(), Arg.Any <IDictionary <string, object> >()) .Returns( info => { invokedViewModel = info.Arg <CloseYearViewModel>(); return(false); }); sut.CloseYear().Should().BeFalse(); invokedViewModel.Should().BeEquivalentTo( new { TextOption = new { Option = OpeningTextOption.AccountName }, RemoteAccount = new { ID = 99999 } }); }