Beispiel #1
0
 public async Task <GLAccount> SaveGLAccount(GLAccount pGLAccount)
 {
     if (pGLAccount.Id == Guid.Empty)
     {
         return(await mAsyncCLient.AddGLAccountAsync(pGLAccount));
     }
     return(await mAsyncCLient.EditGLAccountAsync(pGLAccount));
 }
Beispiel #2
0
        public async Task <BaseResultModel <GLAccount> > CreateOrUpdate(GLAccount pGlAccount)
        {
            var fErrors = Validate(pGlAccount);

            if (fErrors.Count > 0)
            {
                return(new BaseResultModel <GLAccount>(null, string.Join(", ", fErrors)));
            }


            if (pGlAccount.Id != Guid.Empty)
            {
                return(await TryVendorTask(_blue10.EditGLAccountAsync(pGlAccount)));
            }

            pGlAccount.Id = Guid.NewGuid();
            return(await TryVendorTask(_blue10.AddGLAccountAsync(pGlAccount)));
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 public GLAccount EditGLAccount(GLAccount pGLAccount) => mBlue10Async.EditGLAccountAsync(pGLAccount).Sync();