Ejemplo n.º 1
0
        public void TestUpdateProvince()
        {
            Province        provinceOne = new Province(2, "Pekin");
            List <Province> provinces   = new List <Province> {
                provinceOne
            };


            DynamicMock mockLocationsManager = new DynamicMock(typeof(LocationsManager));

            mockLocationsManager.SetReturnValue("GetProvinces", provinces);
            mockLocationsManager.ExpectAndReturn("UpdateProvince", true, provinceOne);


            LocationsManager mocklocationManager = (LocationsManager)mockLocationsManager.MockInstance;
            LocationServices locationService     = new LocationServices(mocklocationManager);

            Assert.AreEqual("Pekin", locationService.GetProvinces()[0].Name);
            Assert.AreEqual(true, locationService.UpdateProvince(provinceOne));
        }