/// <summary> /// 转换为地区实体 /// </summary> /// <param name="dto">地区数据传输对象</param> public static Area ToEntity3(this AreaDto dto) { if (dto == null) { return(new Area()); } return(AreaFactory.Create( areaId: dto.Id.ToGuid(), code: dto.Code, name: dto.Name, longitude: dto.Longitude, latitude: dto.Latitude, parentId: dto.ParentId.ToGuidOrNull(), path: dto.Path, fullPath: dto.FullPath, level: dto.Level.Value, enabled: dto.Enabled.Value, sortId: dto.SortId, pinYin: dto.PinYin, fullPinYin: dto.FullPinYin, creationTime: dto.CreationTime, creatorId: dto.CreatorId, lastModificationTime: dto.LastModificationTime, lastModifierId: dto.LastModifierId, isDeleted: dto.IsDeleted, isLeave: dto.IsLeave, gPSLongitude: dto.GPSLongitude, gPSLatitude: dto.GPSLatitude, version: dto.Version )); }
public void Create_NonexistingKey() { //arrange AreaFactory areaFactory = new AreaFactory(); UndifinedArea undifinedArea = new UndifinedArea(); Type expected = undifinedArea.GetType(); IArea actual; //act actual = areaFactory.Create("RandomKeyNotInFact"); //assert Assert.IsInstanceOfType(actual, expected); }
public void Create_ExistingKey() { //arrange AreaFactory areaFactory = new AreaFactory(); Room room = new Room(); Type expected = room.GetType(); areaFactory.internalFactory.Add <Room>("key"); IArea actual; //act actual = areaFactory.Create("key"); //assert Assert.IsInstanceOfType(actual, expected); }