public async Task <string> ConnectToApiAsync(string fApiKey, string fApiUrl) { mAsyncCLient = Blue10.CreateAsyncClient(fApiKey, fApiUrl); var fMe = await mAsyncCLient.GetMeAsync(); return(fMe.EnvironmentName); }
public async Task SignInvoice_Success( DocumentAction pDocumentAction, string pLedgerCode, [Frozen] IBlue10AsyncClient pBlue10AsyncCLient, InvoiceService pInvoiceService) { // Setup Data pDocumentAction.Status = string.Empty; pDocumentAction.PurchaseInvoice.AdministrationCode = string.Empty; var fExpected = string.Empty; // Setup services pBlue10AsyncCLient.EditDocumentActionAsync(Arg.Any <DocumentAction>()).Returns(fExpected); // Test var fResult = await pInvoiceService.SignInvoice(pDocumentAction, pLedgerCode); // Validate await pBlue10AsyncCLient.Received(1).EditDocumentActionAsync( Arg.Is <DocumentAction>( x => x.Status == "done" && x.PurchaseInvoice.AdministrationCode == pLedgerCode) ); fResult.Should().BeOfType <DocumentAction?>(); fResult.Should().NotBeNull(); }
public async Task GetNewPostInvoiceAction_Success( List <DocumentAction> pDocumentActions, [Frozen] IBlue10AsyncClient pBlue10AsyncCLient, InvoiceService pInvoiceService) { // Setup Data foreach (var pDocumentAction in pDocumentActions) { pDocumentAction.Action = EDocumentAction.post_purchase_invoice; } // Setup services pBlue10AsyncCLient.GetDocumentActionsAsync().Returns(pDocumentActions); // Get expections var fExpectedCount = pDocumentActions.Count; // Test var fResult = await pInvoiceService.GetNewPostInvoiceAction(); // Validate await pBlue10AsyncCLient.Received(1).GetDocumentActionsAsync(); fResult.Should().BeOfType <List <DocumentAction> >(); fResult.Count.Should().Be(fExpectedCount); }
public async Task CreateOrUpdate_Validate_Failed( bool pAdministrationCode, bool pIdCompany, bool pName, Vendor pVendorInput, [Frozen] IBlue10AsyncClient pBlue10AsyncCLient, VendorService pVendorService) { // Setup data if (pAdministrationCode) { pVendorInput.AdministrationCode = string.Empty; } if (pIdCompany) { pVendorInput.IdCompany = string.Empty; } if (pName) { pVendorInput.Name = string.Empty; } // Setup validatione var fErrors = new List <string>(); if (pAdministrationCode) { fErrors.Add("AdministrationCode is empty"); } if (pIdCompany) { fErrors.Add("IdCompany is empty"); } if (pName) { fErrors.Add("Name is empty"); } var fExpected = string.Join(", ", fErrors); // Test var fResult = await pVendorService.CreateOrUpdate(pVendorInput); // Validate pBlue10AsyncCLient.DidNotReceive(); fResult.Should().BeOfType <BaseResultModel <Vendor> >(); fResult.Object.Should().BeNull(); fResult.ErrorMessage.Should().Be(fExpected); }
public CheckCredentialsCommand( ICredentialsService credentialService, IBlue10AsyncClient blue10, IInOutService utilities, ILogger <CheckCredentialsCommand> logger) : base("check", "checks if you can connect to blue10 ") { _credentialService = credentialService; _blue10 = blue10; _utilities = utilities; _logger = logger; Add(new Option <string?>(new[] { "-q", "--query" }, () => null, "A query used to filter out results. NOTE: Dependant on output format. If output is 'json', this is a JMESPath query to filter results. https://jmespath.org/. If output is 'xml', this is an XPATH string. https://www.w3schools.com/xml/xpath_intro.asp")); Add(new Option <EFormatType>(new[] { "-f", "--format" }, () => EFormatType.JSON, "Output format.")); Add(new Option <FileInfo?>(new[] { "-o", "--output" }, () => null, "Enter path to write output of this command to file. Default output is console only")); Handler = CommandHandler.Create <string, EFormatType, FileInfo?>(CheckConnection); }
public async Task CreateOrUpdate_Update_Success( Vendor pVendorInput, Vendor pVendorResult, [Frozen] IBlue10AsyncClient pBlue10AsyncCLient, VendorService pVendorService) { // Setup services pBlue10AsyncCLient.EditVendorAsync(Arg.Any <Vendor>()).Returns(pVendorResult); // Test var fResult = await pVendorService.CreateOrUpdate(pVendorInput); // Validate pBlue10AsyncCLient.Received(1); await pBlue10AsyncCLient.Received().EditVendorAsync(Arg.Is <Vendor>(x => x.Equals(pVendorInput))); fResult.Should().BeOfType <BaseResultModel <Vendor> >(); fResult.ErrorMessage.Should().BeNull(); fResult.Object.Should().Be(pVendorResult); }
public async Task CreateOrUpdate_Update_Success( GLAccount pGLAccountInput, GLAccount pGLAccountResult, [Frozen] IBlue10AsyncClient pBlue10AsyncCLient, GLAccountService pGLAccountService) { // Setup services pBlue10AsyncCLient.EditGLAccountAsync(Arg.Any <GLAccount>()).Returns(pGLAccountResult); // Test var fResult = await pGLAccountService.CreateOrUpdate(pGLAccountInput); // Validate pBlue10AsyncCLient.Received(1); await pBlue10AsyncCLient.Received().EditGLAccountAsync(Arg.Is <GLAccount>(x => x.Equals(pGLAccountInput))); fResult.Should().BeOfType <BaseResultModel <GLAccount> >(); fResult.ErrorMessage.Should().BeNull(); fResult.Object.Should().Be(pGLAccountResult); }
public async Task CreateOrUpdate_Create_Success( VatCode pVatCodeInput, VatCode pVatCodeResult, [Frozen] IBlue10AsyncClient pBlue10AsyncCLient, VatCodeService pVatCodeService) { // Setup data pVatCodeInput.Id = Guid.Empty; // Setup services pBlue10AsyncCLient.AddVatCodeAsync(Arg.Any <VatCode>()).Returns(pVatCodeResult); // Test var fResult = await pVatCodeService.CreateOrUpdate(pVatCodeInput); // Validate pBlue10AsyncCLient.Received(1); await pBlue10AsyncCLient.Received().AddVatCodeAsync(Arg.Is <VatCode>(x => x.Equals(pVatCodeInput))); fResult.Should().BeOfType <BaseResultModel <VatCode> >(); fResult.ErrorMessage.Should().BeNull(); fResult.Object.Should().Be(pVatCodeResult); }
public GLAccountService(IBlue10AsyncClient blue10) { _blue10 = blue10; }
public Blue10Desk(IBlue10AsyncClient pB10Async) { mBlue10Async = pB10Async; }
public CompanyService(IBlue10AsyncClient blue10) { _blue10 = blue10; }
public VendorService(ILogger <VendorService> logger, IBlue10AsyncClient blue10) { _logger = logger; _blue10 = blue10; }
public VatCodeService(IBlue10AsyncClient blue10) { _blue10 = blue10; }
public InvoiceService(IBlue10AsyncClient blue10) { _blue10 = blue10; }