public void GetSectionsByStreet() { Mock<ISectionRepository> mock = new Mock<ISectionRepository>(); mock.Setup(a => a.Sections).Returns(new Section[] { new Section { id = 1, short_name = "IMZ1" , name = "Sekcja Zgrzewania Szyn Skarżysko Kamienna", street = "Piękna 15" }, new Section { id = 2, short_name = "IMZ2", name = "Sekcja Zgrzewania Szyn Kędzierzyn Koźle", street = "Towarowa 5" }, new Section { id = 3, short_name = "IMZ3", name = "Sekcja Zgrzewania Szyn Bydgoszcz", street = "Ludwikowo 2" }, new Section { id = 4, short_name = "IMR1", name = "Sekcja Robót Inżynieryjnych Skarżysko Kamienna", street = "Piękna 15" }, new Section { id = 5, short_name = "IMR2", name = "Sekcja Robót Inżynieryjnych Warszawa", street = "Poskarbińska 51" } }.AsQueryable()); SectionController ctrl = new SectionController(mock.Object); object[] temp = ctrl.GetSectionsByStreet("Piękna 15"); Assert.AreEqual(temp.Length, 2); temp = ctrl.GetSectionsByStreet("Piękna"); Assert.AreEqual(temp.Length, 0); temp = ctrl.GetSectionsByStreet("Towarowa 5"); Assert.AreEqual(temp.Length, 1); }