Example #1
0
        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}"),
            });
        }
Example #2
0
 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;
 }
Example #3
0
        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
            });
        }
Example #4
0
        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>();
        }
Example #5
0
        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>();
        }