public static bool CompareBank(Bank bank, BICDirectoryEntryType loadedBank) { return(bank.Bik == loadedBank.BIC && bank.CorAccounts.All(x => loadedBank.Accounts.Any(y => y.Account == x.CorAccountNumber)) && bank.Name == loadedBank.ParticipantInfo.NameP && bank.Region != null && bank.Region.RegionNum == int.Parse(loadedBank.ParticipantInfo.Rgn)); }
static object[] CompareBankCases() { //source 1 var region1 = CreateNewRegion(); var bank1 = CreateNewBank(region1); var corAccounts1 = CreateNewCorAccounts(bank1, "123456789123456", "987654321987654"); bank1.CorAccounts = corAccounts1; bank1.DefaultCorAccount = corAccounts1[0]; var bankSpr1 = new BICDirectoryEntryType { BIC = bank1.Bik, ParticipantInfo = new ParticipantInfoType { NameP = bank1.Name, Rgn = region1.RegionNum.ToString() }, Accounts = new AccountsType[] { new AccountsType { Account = corAccounts1[0].CorAccountNumber }, new AccountsType { Account = corAccounts1[1].CorAccountNumber } } }; var source1 = new object[] { bank1, bankSpr1, true, "Банки полностью идентичны" }; //source 2 var region2 = CreateNewRegion(); var bank2 = CreateNewBank(region2); var corAccounts2 = CreateNewCorAccounts(bank2, "123456789123456", "987654321987654"); bank2.CorAccounts = corAccounts2; bank2.DefaultCorAccount = corAccounts2[0]; var bankSpr2 = new BICDirectoryEntryType { BIC = bank2.Bik, ParticipantInfo = new ParticipantInfoType { NameP = bank2.Name, Rgn = region2.RegionNum.ToString() }, Accounts = new AccountsType[] { new AccountsType { Account = corAccounts2[0].CorAccountNumber } //специально отсутствует счет corAccounts2[1] } }; var source2 = new object[] { bank2, bankSpr2, false, "Банки отличаются отсутсвием счета в банке из справоника" }; return(new object[] { source1, source2 }); }