public void AddPhoneNumber( int accountId, string phoneNumber, Phone.PhoneServiceTypes phoneServiceType, Phone.PhoneLocationTypes phoneLocationType, int slot, string phoneStatusId) { if (string.IsNullOrEmpty(phoneNumber)) { throw new Exception("Phone number is empty"); } var phone = new Phone { AccountId = accountId, PhoneNumber = phoneNumber, ServiceType = phoneServiceType, LocationType = phoneLocationType, PhoneSlot = slot, PhoneStatusId = phoneStatusId }; PhoneManager.SavePhone(phone, UserId, PositionId); var account = AccountManager.GetAccount(accountId); account.Phones.Add(phone); }
public void Changing_Phone_Service(string phoneNumber, Phone.PhoneServiceTypes service) { var phones = PhoneManager.GetPhones(_testScope.accountId); var oldPhone = phones.SingleOrDefault(p => p.PhoneNumber == phoneNumber); if (oldPhone == null) { return; } var newPhone = _accountTest.DuplicateThisPhone(oldPhone); newPhone.ServiceType = service; _accountTest.UpdatePhone(newPhone, oldPhone); }
public void User_Adds_A_New_Phone_Number( string phoneNumber, string phoneStatus, Phone.PhoneLocationTypes location, Phone.PhoneServiceTypes service) { var accountPhones = PhoneManager.GetPhones(_testScope.accountId); if (accountPhones.FirstOrDefault(x => x.PhoneNumber == phoneNumber) != null) { throw new Exception("This number " + phoneNumber + " already existed on the account"); } var status = _accountTest.GetPhoneStatusMapping(phoneStatus); var phoneSlot = accountPhones.GetNextAvailableSlot(); _accountTest.AddPhoneNumber(_testScope.accountId, phoneNumber, service, location, phoneSlot, status); }
public void VerifyThePhoneServiceType(int slot, Phone.PhoneServiceTypes serviceType) { if (slot == 0) { Assert.Fail("Slot = 0, please check the step"); } _phones = PhoneManager.GetPhones(_testScope.accountId); var phone = _phones.FirstOrDefault(x => x.PhoneSlot == slot); if (phone == null) { _testScope.softAssert.Add(() => { Assert.Fail("Account has no phone to test"); }); } else { _testScope.softAssert.Add(() => { Assert.AreEqual(serviceType, phone.ServiceType); }); } }