public async Task Move_ChildrenAction_Test() { //Act var beijing = await CreateRegion("beijing"); await CreateRegion("dongcheng", beijing.Id); await CreateRegion("xicheng", beijing.Id); var hebei = await CreateRegion("hebei"); await CreateRegion("shijiazhuang", hebei.Id); var chengde = await CreateRegion("chengde", hebei.Id); await CreateRegion("shaungqiao", chengde.Id); await CreateRegion("shaungluan", chengde.Id); var beijingLastChild = GetRegion("xicheng"); beijingLastChild.ShouldNotBeNull(); await _generalRegionTreeManager.MoveAsync(chengde.Id, beijing.Id, x => { x.MyCustomData = x.Code; }); //Assert var shaungqiao = GetRegion("shaungqiao"); shaungqiao.ShouldNotBeNull(); shaungqiao.MyCustomData.ShouldBe(shaungqiao.Code); }
public async Task Move_Test() { //Act var beijing = await CreateRegion("beijing"); await CreateRegion("dongcheng", beijing.Id); await CreateRegion("xicheng", beijing.Id); var hebei = await CreateRegion("hebei"); await CreateRegion("shijiazhuang", hebei.Id); var chengde = await CreateRegion("chengde", hebei.Id); await CreateRegion("shaungqiao", chengde.Id); await CreateRegion("shaungluan", chengde.Id); var beijingLastChild = GetRegion("xicheng"); beijingLastChild.ShouldNotBeNull(); await _generalRegionTreeManager.MoveAsync(chengde.Id, beijing.Id); //Assert var cd = GetRegion(chengde.Name); cd.ShouldNotBeNull(); cd.FullName.ShouldBe(beijing.FullName + "-" + chengde.Name); cd.ParentId.ShouldBe(beijing.Id); cd.Level.ShouldBe(beijing.Level + 1); cd.Code.ShouldBe(GeneralTreeCodeGenerate.GetNextCode(beijingLastChild.Code)); }