Пример #1
0
        public void CanGetActives()
        {
            MockRepository         mock        = new MockRepository();
            IDistributorRepository mockedRepos = mock.CreateMock <IDistributorRepository>();

            Contact expContact1 = new Contact("1", "l1", "1@1");
            Contact expContact2 = new Contact("2", "l2", "2@1");
            Contact expContact3 = new Contact("3", "l3", "3@1");
            Contact expContact4 = new Contact("4", "l4", "4@1");


            IList <Contact> expContactsLst = new List <Contact>();

            expContactsLst.Add(expContact1);
            expContactsLst.Add(expContact2);
            expContactsLst.Add(expContact3);
            expContactsLst.Add(expContact4);

            Expect.Call(mockedRepos.GetActiveContacts()).Return(expContactsLst);
            mock.ReplayAll();

            DistributorController dc = new DistributorController(mockedRepos);

            IList <Contact> lst = dc.GetActivesContacts();

            Assert.AreEqual(lst.Count, 4);
        }