public void Should_return_success_true() { //IDeclarationBll declarationBll = new IDeclarationBll(); var declarationBll = new Mock <IDeclarationBll>(); AddDeclarationService addDeclaration = new AddDeclarationService(declarationBll.Object); //arrange AddDeclaration newDeclaration = new AddDeclaration(); var Declaration = new DeclarationDto(); // newDeclaration.Declaration = new Declarations.Contracts.DeclarationDTO.DeclarationDto(); Declaration.Amount = "1001"; Declaration.ConsigneePostalCode = "100"; Declaration.ConsignorPostalCode = "100"; Declaration.DeclarantPostalCode = "101"; Declaration.ConsignorCity = "abc"; Declaration.ConsigneeCity = "abc"; Declaration.DeclarationId = Guid.NewGuid(); newDeclaration.Declaration = Declaration; newDeclaration.ReferenceData = new ReferenceDto[0]; declarationBll.Setup(d => d.AddDeclaration(newDeclaration.Declaration)).Returns(newDeclaration.Declaration.DeclarationId); //act var expectedResult = addDeclaration.Post(newDeclaration); //assert Assert.That(expectedResult.Success, Is.EqualTo(true)); }
public Guid AddDeclaration(DeclarationDto declarationDto) { try { return(DeclarationDal.AddDeclaration(declarationDto)); } catch (Exception) { throw; } }
public bool EditDeclaration(DeclarationDto declarationDto) { try { return(DeclarationDal.EditDeclaration(declarationDto)); } catch (Exception) { throw; } }
public DeclarationViewModel(PageService pageservice, UserService userService, EventBus eventBus, BL.DeclarationService declarationService) : base(pageservice) { this.userService = userService; this.eventBus = eventBus; this.declarationService = declarationService; Declaration = declarationService.GetDeclaration(); IsPaid = Declaration.DecStatus == DecStatus.ActivePaid && declarationService.IsEdit; init(); }
public OperationResponse <bool> POST(SendToCustom res) { OperationResponse <bool> response = new OperationResponse <bool>(); try { DeclarationDto declaration = res.Declaration; var data = DeclarationBll.SendToCustom(declaration); response.OnSuccess(data, "Success"); return(response); } catch (Exception e) { Log.Error(e.Message + e.StackTrace); response.OnException("Failed at server side"); return(response); } }
public DeclarationDto GetDeclarationById(Guid id) { DeclarationDto declarationDto = new DeclarationDto(); try { using (var context = new CTDSContext()) { var declaration = context.Declaration.Find(id); declarationDto = Mapper.DeclarationToDto(declaration); } return(declarationDto); } catch (Exception) { throw; } }
public bool SendToCustom(DeclarationDto declarationDto) { bool result = false; try { using (var context = new CTDSContext()) { var declaration = Mapper.DtoToDeclaration(declarationDto); context.Declaration.AddOrUpdate(declaration); context.SaveChanges(); result = true; } return(result); } catch (Exception) { throw; } }
public Guid AddDeclaration(DeclarationDto declarationDto) { Guid success; try { using (var context = new CTDSContext()) { var declaration = Mapper.DtoToDeclaration(declarationDto); var newDeclaration = context.Declaration.Add(declaration); context.SaveChanges(); success = newDeclaration.DeclarationId; } return(success); } catch (Exception) { throw; } }
public bool EditDeclaration(DeclarationDto declarationDto) { bool response; try { using (var context = new CTDSContext()) { //_context.Declaration.Log = s => { System.Diagnostics.Debug.WriteLine(s); }; var declaration = Mapper.DtoToDeclaration(declarationDto); context.Declaration.AddOrUpdate(declaration); context.SaveChanges(); response = true; } return(response); } catch (Exception) { throw; } }
public bool SendToCustom(DeclarationDto declaration) { try { if (declaration.MessageName == "FU" && declaration.Amount != "") { declaration.Status = "Cleared"; } else if (declaration.Amount == "") { declaration.Status = "Rejected"; } else { declaration.Status = "Processing"; } return(DeclarationDal.SendToCustom(declaration)); } catch (Exception) { throw; } }
public Declaration DtoToDeclaration(DeclarationDto declarationDto) { return(Mapper.Map <Declaration>(declarationDto)); }
public void SetupFilledDeclaration(DeclarationDto dto) { _currentDec = mapper.MapTo <DeclarationDto, Declaration>(dto, _currentDec); }