public void Create_BillingAccountId_ExpectValidId()
        {
            //Arrange
            string localId = "abc123";

            //Act
            BillingAccountId localBillingAccountId = new BillingAccountId(localId);

            //Assert
            Assert.AreEqual(localBillingAccountId.IdString, localId);
        }
        public void Create_BillingAccountId_ExpectValidId()
        {
            //Arrange
            string localId = "abc123";

            //Act
            BillingAccountId localBillingAccountId = new BillingAccountId(localId);

            //Assert
            Assert.AreEqual(localBillingAccountId.IdString, localId);
        }
        public static BillingAccount NewBillingAccount(string billingCompanyIdString,
            string billingAccountUsername, string billingAccountPassword)
        {
            //billing account id string formulation, calls a service to perform action
            IBillingAccountService billingAccountService = new BillingAccountService();
            string localBillingAccountIdString = billingAccountService.CreateBillingAccountId();
            BillingAccountId localBillingAccountId = new BillingAccountId(localBillingAccountIdString);

            BillingCompanyId localBillingCompanyId = new BillingCompanyId(billingCompanyIdString);

            return new BillingAccount(localBillingAccountId, localBillingCompanyId, billingAccountUsername, billingAccountPassword, new APSUser.APSUser(new APSUser.APSUserId("1"), "testUsername", "testPassword"));
        }
        public void Compare_BillingAccountId_ExpectObjectImmutability()
        {
            //Arrange
            string localId1 = "abc123";
            string localId2 = "abc123";

            //Act
            BillingAccountId localBillingAccountId1 = new BillingAccountId(localId1);
            BillingAccountId localBillingAccountId2 = new BillingAccountId(localId2);

            //Assert
            Assert.AreEqual(localBillingAccountId1.IdString, localBillingAccountId2.IdString);
        }
        public void Compare_BillingAccountId_ExpectObjectImmutability()
        {
            //Arrange
            string localId1 = "abc123";
            string localId2 = "abc123";

            //Act
            BillingAccountId localBillingAccountId1 = new BillingAccountId(localId1);
            BillingAccountId localBillingAccountId2 = new BillingAccountId(localId2);

            //Assert
            Assert.AreEqual(localBillingAccountId1.IdString, localBillingAccountId2.IdString);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="BillingAccount"/> class.
 /// </summary>
 /// <param name="billingAccountId">The billing account identifier.</param>
 /// <param name="billingCompanyId">The billing company identifier.</param>
 /// <param name="billingAccountUsername">The billing account username.</param>
 /// <param name="billingAccountPassword">The billing account password.</param>
 /// <exception cref="System.ArgumentNullException"></exception>
 public BillingAccount(BillingAccountId billingAccountId, BillingCompanyId billingCompanyId, 
     string billingAccountUsername, string billingAccountPassword, APSUser apsUser)
 {
     if (billingAccountId != null && billingCompanyId !=null &&
         !string.IsNullOrEmpty(billingAccountUsername) && !string.IsNullOrEmpty(billingAccountPassword))
     {
         _billingAccountId = billingAccountId;
         _billingCompanyId = billingCompanyId;
         _billingAccountUsername = billingAccountUsername;
         _billingAccountPassword = billingAccountPassword;
         _apsUser = apsUser;
     }
     else
     {
         throw new ArgumentNullException();
     }
 }
        public void Create_BillingAccount_ExpectValid()
        {
            //Arrange
            string localBillingAccountIdString = "APSBA01";
            string localBillingCompanyIdString = "COJ01";
            string localBillingAccountUsername = "******";
            string localBillingAccountPassword = "******";
            BillingAccountId localBillingAccountId = new BillingAccountId(localBillingAccountIdString);
            BillingCompanyId localBillingCompanyId = new BillingCompanyId(localBillingCompanyIdString);
            APSUser localAPSUser = new APSUser(new APSUserId("1"), "testuser", "testPasssword");

            //Act
            BillingAccount localBillingAccount = new BillingAccount(localBillingAccountId,
                localBillingCompanyId, localBillingAccountUsername, localBillingAccountPassword, localAPSUser);

            //Assert
            Assert.AreEqual(localBillingAccount.BillingAccountId, localBillingAccountId);
            Assert.AreEqual(localBillingAccount.BillingCompanyId, localBillingCompanyId);
            Assert.AreEqual(localBillingAccount.BillingAccountUsername, localBillingAccountUsername);
            Assert.AreEqual(localBillingAccount.BillingAccountPassword, localBillingAccountPassword);
        }
        public void Create_BillingAccount_ExpectValid()
        {
            //Arrange
            string           localBillingAccountIdString = "APSBA01";
            string           localBillingCompanyIdString = "COJ01";
            string           localBillingAccountUsername = "******";
            string           localBillingAccountPassword = "******";
            BillingAccountId localBillingAccountId       = new BillingAccountId(localBillingAccountIdString);
            BillingCompanyId localBillingCompanyId       = new BillingCompanyId(localBillingCompanyIdString);
            APSUser          localAPSUser = new APSUser(new APSUserId("1"), "testuser", "testPasssword");

            //Act
            BillingAccount localBillingAccount = new BillingAccount(localBillingAccountId,
                                                                    localBillingCompanyId, localBillingAccountUsername, localBillingAccountPassword, localAPSUser);

            //Assert
            Assert.AreEqual(localBillingAccount.BillingAccountId, localBillingAccountId);
            Assert.AreEqual(localBillingAccount.BillingCompanyId, localBillingCompanyId);
            Assert.AreEqual(localBillingAccount.BillingAccountUsername, localBillingAccountUsername);
            Assert.AreEqual(localBillingAccount.BillingAccountPassword, localBillingAccountPassword);
        }
示例#9
0
        public void Add_BillingAccount_ExpectAccountAdded()
        {
            //Arrange
            string    localAPSUserIdString = "APS01";
            string    localUsername        = "******";
            string    localPassword        = "******";
            APSUserId localAPSUserId       = new APSUserId(localAPSUserIdString);
            APSUser   localAPSUser         = new APSUser(localAPSUserId, localUsername, localPassword);

            string           localBillingAccountIdString = "APSBA01";
            string           localBillingCompanyIdString = "COJ01";
            string           localBillingAccountUsername = "******";
            string           localBillingAccountPassword = "******";
            BillingAccountId localBillingAccountId       = new BillingAccountId(localBillingAccountIdString);
            BillingCompanyId localBillingCompanyId       = new BillingCompanyId(localBillingCompanyIdString);
            BillingAccount   localBillingAccount         = new BillingAccount(localBillingAccountId,
                                                                              localBillingCompanyId, localBillingAccountUsername, localBillingAccountPassword, localAPSUser);

            //Act
            localAPSUser.AddBillingAccount(localBillingAccount);

            //Assert
            Assert.AreEqual(localAPSUser.BillingAccounts.First(ba => ba.BillingAccountId == localBillingAccountId), localBillingAccount);
        }
        public void Add_BillingAccount_ExpectAccountAdded()
        {
            //Arrange
            string localAPSUserIdString = "APS01";
            string localUsername = "******";
            string localPassword = "******";
            APSUserId localAPSUserId = new APSUserId(localAPSUserIdString);
            APSUser localAPSUser = new APSUser(localAPSUserId, localUsername, localPassword);

            string localBillingAccountIdString = "APSBA01";
            string localBillingCompanyIdString = "COJ01";
            string localBillingAccountUsername = "******";
            string localBillingAccountPassword = "******";
            BillingAccountId localBillingAccountId = new BillingAccountId(localBillingAccountIdString);
            BillingCompanyId localBillingCompanyId = new BillingCompanyId(localBillingCompanyIdString);
            BillingAccount localBillingAccount = new BillingAccount(localBillingAccountId,
               localBillingCompanyId, localBillingAccountUsername, localBillingAccountPassword, localAPSUser);

            //Act
            localAPSUser.AddBillingAccount(localBillingAccount);

            //Assert
            Assert.AreEqual(localAPSUser.BillingAccounts.First(ba => ba.BillingAccountId == localBillingAccountId),localBillingAccount);
        }
示例#11
0
 public BillingAccount(BillingAccountId id)
 {
     Id = id ?? throw new ArgumentNullException(nameof(id));
 }