public void OnEditAccount_ImportPatternsConfigured_ImportPatternsBuilt() { var windowManager = Substitute.For <IWindowManager>(); AccountViewModel updatedViewModel = null; windowManager.ShowDialog(Arg.Do <object>(o => updatedViewModel = o as AccountViewModel), null, null); var projectData = new ProjectData(new Settings(), null !, null !, null !, null !); var sut = new AccountsViewModel(windowManager, projectData); projectData.Storage.Accounts = new List <AccountingDataAccountGroup> { new AccountingDataAccountGroup { Name = "Group", Account = new List <AccountDefinition> { new AccountDefinition { ID = 1, Name = "Asset", Type = AccountDefinitionType.Asset }, new AccountDefinition { ID = 2, Name = "Income", Type = AccountDefinitionType.Income }, new AccountDefinition { ID = 3, Name = "CarryForward", Type = AccountDefinitionType.Carryforward } } } }; projectData.Storage.Accounts.First().Account.First().ImportMapping = new AccountDefinitionImportMapping { Patterns = new List <AccountDefinitionImportMappingPattern> { new AccountDefinitionImportMappingPattern { Expression = "Expression", AccountID = 2 } } }; sut.OnDataLoaded(); var accountViewModel = sut.AccountList.First(); accountViewModel.ImportRemoteAccounts.Should().BeEmpty(); sut.OnEditAccount(accountViewModel); updatedViewModel?.ImportRemoteAccounts.Should().BeEquivalentTo(new[] { new { ID = 2 } }); }