public void TestMockDeleteTownAction(int cityId, int districtId, int townId, bool success)
 {
     TownOperationService service = new TownOperationService(townRepository.Object,
         "City" + cityId, "District" + districtId, "Town" + townId);
     if (success)
     {
         Assert.IsTrue(service.DeleteOneTown(null, null));
     }
     else
     {
         Assert.IsFalse(service.DeleteOneTown(null, null));
     }
 }
Ejemplo n.º 2
0
 public void TestDeleteTown_WithWhiteSpace_Success()
 {
     TownOperationService service = new TownOperationService(repository.Object,
         "Foshan ", "Chancheng ", "Zhangcha");
     Assert.IsTrue(service.DeleteOneTown());
     Assert.AreEqual(repository.Object.Count(), 0);
 }
 public void TestMockDeleteTown_NullENodebRepository()
 {
     TownOperationService service = new TownOperationService(mockTownRepository.Object,
         "City1", "District1", "Town1");
     Assert.IsTrue(service.DeleteOneTown(null,null));
     Assert.AreEqual(mockTownRepository.Object.Count(), 0);
 }
Ejemplo n.º 4
0
 public void TestDeleteTown_WithENodebInfos_Fail()
 {
     TownOperationService service = new TownOperationService(repository.Object,
         "Foshan ", "Chancheng ", "Zhangcha");
     Assert.IsFalse(service.DeleteOneTown(lteRepository.Object, null));
     Assert.AreEqual(repository.Object.Count(), 1);
 }
Ejemplo n.º 5
0
 public void TestDeleteTown_Fail()
 {
     TownOperationService service = new TownOperationService(repository.Object,
         "Foshan", "Chancheng", "Zumiao");
     Assert.IsFalse(service.DeleteOneTown());
     Assert.AreEqual(repository.Object.Count(), 1);
 }
 public void TestMockDeleteTown_WrongENodebRepository()
 {
     mockENodebRepository.Setup(x => x.GetAll()).Returns(new List<ENodeb> {
         new ENodeb { TownId = 21, Name = "E1" }
     }.AsQueryable());
     TownOperationService service = new TownOperationService(mockTownRepository.Object,
         "City1", "District1", "Town1");
     Assert.IsTrue(service.DeleteOneTown(mockENodebRepository.Object,null));
     Assert.AreEqual(mockTownRepository.Object.Count(), 0);
 }
Ejemplo n.º 7
0
 public ActionResult DeleteTown(RegionViewModel viewModel)
 {
     TownOperationService service = new TownOperationService(townRepository, viewModel);
     bool result = service.DeleteOneTown(eNodebRepository, btsRepository);
     if (result)
     {
         TempData["success"] = viewModel.DeleteSuccessMessage;
     }
     else
     {
         TempData["error"] = viewModel.DeleteFailMessage;
     }
     return RedirectToAction("Region");
 }
Ejemplo n.º 8
0
 public void TestSaveAndDeleteTown_AddSuccess_DeleteFail()
 {
     Assert.AreEqual(repository.Object.Count(), 1);
     TownOperationService service = new TownOperationService(repository.Object,
         "Foshan", "Nanhai ", "Guicheng ");
     service.SaveOneTown();
     Assert.AreEqual(repository.Object.Count(), 2);
     service = new TownOperationService(repository.Object,
         "Foshan", "Nanhai", "Dali");
     Assert.IsFalse(service.DeleteOneTown());
     Assert.AreEqual(repository.Object.Count(), 2);
 }
Ejemplo n.º 9
0
 public void TestSaveAndDeleteTown_AddFail_DeleteSuccess()
 {
     Assert.AreEqual(repository.Object.Count(), 1);
     TownOperationService service = new TownOperationService(repository.Object,
         "Foshan", "Chancheng ", "Zhangcha ");
     service.SaveOneTown();
     Assert.AreEqual(repository.Object.Count(), 1, "Add town success! But it's expected to be failed!");
     service = new TownOperationService(repository.Object,
         "Foshan", "Chancheng ", "Zhangcha ");
     Assert.IsTrue(service.DeleteOneTown());
     Assert.AreEqual(repository.Object.Count(), 0);
 }
Ejemplo n.º 10
0
 public void TestSaveAndDeleteTown_AddSuccess_DeleteSucess()
 {
     Assert.AreEqual(repository.Object.Count(), 1, "original");
     TownOperationService service = new TownOperationService(repository.Object,
         "Foshan", "Nanhai ", "Guicheng ");
     service.SaveOneTown();
     Assert.AreEqual(repository.Object.Count(), 2, "save");
     repository.MockRepositoryDeleteItems<Town, ITownRepository>();
     service = new TownOperationService(repository.Object,
         "Foshan", "Nanhai", "Guicheng");
     Assert.IsTrue(service.DeleteOneTown());
     Assert.AreEqual(repository.Object.Count(), 1, "delete");
 }
Ejemplo n.º 11
0
 public bool TestDeleteTown(int cityId, int districtId, int townId,
     IENodebRepository eNodebRepository, IBtsRepository btsRepository)
 {
     service = new TownOperationService(repository,
         "C-" + cityId, "D-" + districtId, "T-" + townId);
     return service.DeleteOneTown(eNodebRepository, btsRepository);
 }
Ejemplo n.º 12
0
 public bool TestDeleteTown(int cityId, int districtId, int townId)
 {
     service = new TownOperationService(repository,
         "C-" + cityId, "D-" + districtId, "T-" + townId);
     return service.DeleteOneTown();
 }