static void Main(string[] args) { //Лёгкая демонстрация. ExtendedDictionary<UserType, int, string> a = new ExtendedDictionary<UserType, int, string>(); #region Заполнение базы a[ new UserType("Nikita", 23), 37] = "Programmer"; a[ new UserType("Nikita", 23), 666] = "Clone"; a[ new UserType("Andrey", 33), 38] = "1st Programmer"; a[ new UserType("Nikolay", 13), 39] = "Bad Programmer"; a[ new UserType("Alex", 93), 375] = "Ex Programmer"; a[ new UserType("Marina", 43), 371] = "Seller"; a[ new UserType("Daniil", 20), 370] = "Dealer"; a[ new UserType("Dima", 25), 3722] = "Worker"; a.Add(new UserType("Misha", 13), 37333, "Human"); a.Add(new UserType("Vasya", 53), 3711, "Slave"); a.Add(new UserType("Yulia", 22), 377, "Runer"); a.Add(new UserType("Bruce", 40), 3766, "Batman"); #endregion Console.WriteLine("Какую должность занимает Юля с id=377? :\n" + a[new UserType("Yulia", 22), 377]); Console.WriteLine(); Console.WriteLine("Люди, имеющие сигнатуру <'Nikita', 23> занимают должности:"); foreach (var item in a.GetById(new UserType("Nikita", 23))) { Console.WriteLine(item); } Console.WriteLine(); Console.WriteLine("Должности людей с id = 375:"); foreach (var item in a.GetByName(375)) { Console.WriteLine(item); } Console.WriteLine(); var b= new ExtendedDictionary<int, string, int>(); b.Add(2, "test", 0); Console.WriteLine(); Console.WriteLine("Выведем все значения в базе:"); Console.WriteLine("Name/Age signature".PadRight(12) +"| id".PadRight(8) + " | Possition\n"); foreach (var item in a) { Console.WriteLine(item.Key + " " + item.Value); } Console.ReadLine(); }
public void TestFastAccessByName_ExpectedMas_2_5() { var a = new ExtendedDictionary<int,string, int>(); a.Add(2,"test", 2); a.Add(3,"test", 5); a.Add(5,"no_test", 7); Assert.AreEqual(new int[] { 2, 5 }, a.GetByName("test")); }