public void GetReturnsMultipleObjects() { // Arrange List <Property> properties = new List <Property>(); properties.Add(new Property { Id = 1, Place = "Place1" }); properties.Add(new Property { Id = 2, Place = "Place2" }); var mockRepository = new Mock <IPropertyRepository>(); mockRepository.Setup(x => x.GetAll()).Returns(properties.AsEnumerable()); var controller = new PropertiesController(mockRepository.Object); // Act IEnumerable <Property> result = controller.GetAll(); // Assert Assert.IsNotNull(result); Assert.AreEqual(properties.Count, result.ToList().Count); Assert.AreEqual(properties.ElementAt(0), result.ElementAt(0)); Assert.AreEqual(properties.ElementAt(1), result.ElementAt(1)); }