public override SectionDTO CastToRNT(dynamic byf) { var nme = As.Text(byf.label); return(new SectionDTO { Id = As.ID(byf.nid), Name = nme, IsActive = true, StallTemplate = StallDTO.Named(nme + " {0:000}"), }); }
public LeaseColxnRow(SectionDTO sec, AmbulantColxnDTO dto) { Lease = new LeaseDTO { Tenant = TenantModel.Named(dto.ReceivedFrom), Stall = StallDTO.Named($"{sec.Name} Section Ambulant") }; AmbulantDTO = dto; DocumentRef = dto.PRNumber?.ToString(); Ambulant = dto.Amount; Remarks = dto.Remarks; }
public override IDocumentDTO CastByfToDTO(object byfRecord) { var byf = Cast(byfRecord); var nme = byf.Label.Value.Trim(); return(new SectionDTO { Id = (int)byf.Id.Value, Name = nme, StallTemplate = StallDTO.Named(nme + " {0:000}"), IsActive = byf.IsOperational }); }
public void InsertRejectsduplicatestallname() { var moq = new Mock <ISimpleRepo <StallDTO> >(); var sut = new StallsRepo1(moq.Object, null); var stall = StallDTO.Named("sample"); moq.Setup(_ => _.GetAll()) .Returns(new List <StallDTO> { stall }); sut.Invoking(_ => _.Insert(stall)) .Should().Throw <DuplicateRecordsException>(); }
public void CantDeleteifOccupied() { var moq = new Mock <ISimpleRepo <StallDTO> >(); var db = new MockMarketState(); var sut = new StallsRepo1(moq.Object, db); var stall = StallDTO.Named("sample"); db.MoqActiveLeases.Setup(_ => _.GetAll()) .Returns(new List <LeaseDTO> { new LeaseDTO { Stall = stall } }); sut.Invoking(_ => _.Delete(stall)).Should() .Throw <InvalidDeletionException>(); }