Ejemplo n.º 1
0
        public void GetStatementsAutonomousScope()
        {
            // Given
            RecognizedUserInfo recognizedUserInfo = RecognizedUserInfo.Current();
            IFluentClient      client             = AspenClient.Initialize()
                                                    .RoutingTo(this.autonomousAppInfoProvider)
                                                    .WithIdentity(this.autonomousAppInfoProvider)
                                                    .Authenticate()
                                                    .GetClient();

            // When
            var statements = client.Financial.GetStatements(recognizedUserInfo.DocType, recognizedUserInfo.DocNumber, recognizedUserInfo.AccountId).ToList();

            PrintOutput("Statements", statements);

            // Then
            Assert.That(statements.Count(), NUnit.Framework.Is.EqualTo(5));
            const string AccountTypesPattern = "^80|81|82|83|84|85$";

            foreach (var statement in statements)
            {
                Assert.That(statement.AccountTypeId, NUnit.Framework.Is.Not.Null.And.Match(AccountTypesPattern));
                Assert.That(statement.Amount, NUnit.Framework.Is.AssignableTo(typeof(decimal)));
                Assert.That(statement.CardAcceptor, NUnit.Framework.Is.Not.Null);
                Assert.That(statement.TranName, NUnit.Framework.Is.Not.Null);
                Assert.That(statement.TranType, NUnit.Framework.Is.Not.Null);
            }
        }
Ejemplo n.º 2
0
        public void GetAccountsAutonomousScope()
        {
            // Given
            RecognizedUserInfo recognizedUserInfo = RecognizedUserInfo.Current();
            IFluentClient      client             = AspenClient.Initialize()
                                                    .RoutingTo(this.autonomousAppInfoProvider)
                                                    .WithIdentity(this.autonomousAppInfoProvider)
                                                    .Authenticate()
                                                    .GetClient();

            // When
            List <IAccountInfo> accounts = client.Financial.GetAccounts(recognizedUserInfo.DocType, recognizedUserInfo.DocNumber).ToList();

            PrintOutput("Accounts", accounts);

            // Then
            Assert.That(accounts.Count(), NUnit.Framework.Is.EqualTo(1));
            List <AccountProperty> properties = accounts.First().Properties.ToList();

            Assert.That(properties.Count(), NUnit.Framework.Is.EqualTo(4));
            Assert.That(properties.SingleOrDefault(p => p.Key == "LastTranName"), NUnit.Framework.Is.Not.Null);
            Assert.That(properties.SingleOrDefault(p => p.Key == "LastTranDate"), NUnit.Framework.Is.Not.Null);
            Assert.That(properties.SingleOrDefault(p => p.Key == "LastTranCardAcceptor"), NUnit.Framework.Is.Not.Null);
            Assert.That(properties.SingleOrDefault(p => p.Key == "CardStatusName"), NUnit.Framework.Is.Not.Null);
        }
Ejemplo n.º 3
0
        public void GetBalancesAutonomousScope()
        {
            // Given
            RecognizedUserInfo recognizedUserInfo = RecognizedUserInfo.Current();
            IFluentClient      client             = AspenClient.Initialize()
                                                    .RoutingTo(this.autonomousAppInfoProvider)
                                                    .WithIdentity(this.autonomousAppInfoProvider)
                                                    .Authenticate()
                                                    .GetClient();

            // When
            List <IBalanceInfo> balances = client.Financial.GetBalances(recognizedUserInfo.DocType, recognizedUserInfo.DocNumber, recognizedUserInfo.AccountId).ToList();

            // Then
            Assert.That(balances.Count(), NUnit.Framework.Is.EqualTo(5));
        }
Ejemplo n.º 4
0
        public void GetBalancesDelegatedScope()
        {
            // Given
            RecognizedUserInfo recognizedUserInfo = RecognizedUserInfo.Current();
            DelegatedUserInfo  userCredentials    = GetDelegatedUserCredentials();
            IFluentClient      client             = AspenClient.Initialize(AppScope.Delegated)
                                                    .RoutingTo(this.delegatedAppInfoProvider)
                                                    .WithIdentity(this.delegatedAppInfoProvider)
                                                    .Authenticate(userCredentials)
                                                    .GetClient();

            // When
            List <IBalanceInfo> balances = client.Financial.GetBalances(recognizedUserInfo.AccountId).ToList();

            // Then
            Assert.That(balances.Count(), NUnit.Framework.Is.EqualTo(5));
        }