public void TestUpdateCity() { City city = new City { Name = "Pekin", DistrictId = 12 }; List <City> cities = new List <City> { city }; DynamicMock mockLocationsManager = new DynamicMock(typeof(LocationsManager)); mockLocationsManager.ExpectAndReturn("AddCity", 3, city); mockLocationsManager.SetReturnValue("GetCities", cities); mockLocationsManager.ExpectAndReturn("UpdateCity", true, city); LocationsManager mocklocationManager = (LocationsManager)mockLocationsManager.MockInstance; LocationServices locationService = new LocationServices(mocklocationManager); Assert.AreEqual("Pekin", locationService.GetCities()[0].Name); Assert.AreEqual(true, locationService.UpdateCity(city)); }