public void GetRelatedTransactions_Account_CorrectAccounts() { var accountRepoSetup = new Mock<IDataAccess<Account>>(); accountRepoSetup.Setup(x => x.LoadList(null)).Returns(new List<Account>()); var dataAccessSetup = new Mock<IDataAccess<FinancialTransaction>>(); dataAccessSetup.Setup(x => x.LoadList(null)).Returns(new List<FinancialTransaction>()); var repo = new TransactionRepository(dataAccessSetup.Object, new Mock<IDataAccess<RecurringTransaction>>().Object); var account1 = new Account {Id = 1}; var account3 = new Account {Id = 3}; repo.Data = new ObservableCollection<FinancialTransaction>(new List<FinancialTransaction> { new FinancialTransaction {Id = 2, ChargedAccount = account1, ChargedAccountId = account1.Id}, new FinancialTransaction {Id = 5, ChargedAccount = account3, ChargedAccountId = account3.Id} }); var result = repo.GetRelatedTransactions(account1); result.Count().ShouldBe(1); result.First().Id.ShouldBe(2); }