Esempio n. 1
0
        public void TestDeleteProvinceWithDistrictIn()
        {
            Province provinceOne = new Province(2, "Pekin");
            Province provinceTwo = new Province(8, "Qhinghua");

            List <District> districts = new List <District>
            {
                new District("Paris", provinceOne),
                new District("Pekin", provinceOne),
                new District("Pau", provinceOne)
            };


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

            dynamicMock.SetReturnValue("GetDistricts", districts);
            dynamicMock.Expect("DeleteProvinceById", 8);


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

            Assert.AreEqual(false, locationService.DeleteProvince(provinceOne));
        }