public void DoesntSendFeeChangeEmail()
            {
                var customerId = new Guid("11111111-1111-1111-1111-111111111111");
                var customer   = new CustomerEntity
                {
                    CustomerId                   = customerId,
                    Name                         = "Test Customer",
                    InNetworkFlatFee             = 10.00m,
                    CustomerContacts             = new List <CustomerContactEntity>(),
                    CustomerCarrierScacContracts = new List <CustomerCarrierScacContractEntity>()
                };
                var updatedCustomer = new CustomerProfileData()
                {
                    CustomerId                     = customerId,
                    CustomerLoadTypeId             = (int)CustomerLoadTypeEnum.HighPriority,
                    CustomerLoadTypeExpirationDate = null,
                    InNetworkFlatFee               = 10.00m,
                    CustomerContacts               = new List <CustomerContactData>(),
                    CustomerCarrierScacs           = new List <string>()
                };

                _db = new MockDbBuilder()
                      .WithCustomer(customer)
                      .Build();
                _userContext.SetupGet(_ => _.FirstName).Returns("fname");
                _userContext.SetupGet(_ => _.LastName).Returns("lname");
                _svc = BuildService();

                _svc.UpdateShipper(updatedCustomer, USERNAME);

                _notificationService.Verify(_ => _.SendShipperFeeChangeEmail(customer, updatedCustomer, "fname lname"), Times.Never);
            }
            public void CustomerLoadTypeId_NewShipper_Valid()
            {
                _svc = BuildService();

                _svc.ValidateCustomerOrderType(new CustomerProfileData()
                {
                    CustomerLoadTypeId             = (int)CustomerLoadTypeEnum.NewShipper,
                    CustomerLoadTypeExpirationDate = DateTime.Today
                });
            }
            public void InvalidCustomerLoadType()
            {
                _svc = BuildService();

                _svc.Invoking(x => x.AddShipper(new CustomerProfileData()
                {
                    CustomerLoadTypeId             = (int)CustomerLoadTypeEnum.NewShipper,
                    CustomerLoadTypeExpirationDate = null
                }, USERNAME)).Should()
                .Throw <ValidationException>()
                .WithMessage("Expiration Date is required for New Shipper type.");
            }
            public void TooHighInNetworkPercentFee()
            {
                _svc = BuildService();

                _svc.Invoking(x => x.AddShipper(new CustomerProfileData()
                {
                    CustomerLoadTypeId             = (int)CustomerLoadTypeEnum.HighPriority,
                    CustomerLoadTypeExpirationDate = null,
                    InNetworkPercentFee            = 10.00m
                }, USERNAME)).Should()
                .Throw <ValidationException>()
                .WithMessage("In Network Flat Fee must be less than 1,000%.");
            }
            public void NegativeInNetworkFlatFee()
            {
                _svc = BuildService();

                _svc.Invoking(x => x.AddShipper(new CustomerProfileData()
                {
                    CustomerLoadTypeId             = (int)CustomerLoadTypeEnum.HighPriority,
                    CustomerLoadTypeExpirationDate = null,
                    InNetworkFlatFee = -0.01m
                }, USERNAME)).Should()
                .Throw <ValidationException>()
                .WithMessage("In Network Flat Fee must be $0.00 or more.");
            }
            public void NegativeOutNetworkPercentFee()
            {
                _svc = BuildService();

                _svc.Invoking(x => x.UpdateShipper(new CustomerProfileData()
                {
                    CustomerId                     = Guid.NewGuid(),
                    CustomerLoadTypeId             = (int)CustomerLoadTypeEnum.HighPriority,
                    CustomerLoadTypeExpirationDate = null,
                    OutNetworkPercentFee           = -0.01m
                }, USERNAME)).Should()
                .Throw <ValidationException>()
                .WithMessage("Out Network Flat Fee must be 0.00% or more.");
            }
            public void CustomerLoadTypeId_HighPriority()
            {
                _svc = BuildService();
                _svc.ValidateCustomerOrderType(new CustomerProfileData()
                {
                    CustomerLoadTypeId             = (int)CustomerLoadTypeEnum.HighPriority,
                    CustomerLoadTypeExpirationDate = null
                });

                _svc.ValidateCustomerOrderType(new CustomerProfileData()
                {
                    CustomerLoadTypeId             = (int)CustomerLoadTypeEnum.HighPriority,
                    CustomerLoadTypeExpirationDate = DateTime.Today
                });
            }
            public void SendsFeeChangeEmail()
            {
                var customerId      = new Guid("11111111-1111-1111-1111-111111111111");
                var updatedCustomer = new CustomerProfileData()
                {
                    CustomerId                     = customerId,
                    CustomerLoadTypeId             = (int)CustomerLoadTypeEnum.HighPriority,
                    CustomerLoadTypeExpirationDate = null,
                    InNetworkFlatFee               = 10.00m,
                    CustomerContacts               = new List <CustomerContactData>(),
                    CustomerCarrierScacs           = new List <string>()
                };

                _userContext.SetupGet(_ => _.FirstName).Returns("fname");
                _userContext.SetupGet(_ => _.LastName).Returns("lname");
                _svc = BuildService();

                _svc.AddShipper(updatedCustomer, USERNAME);

                _notificationService.Verify(_ => _.SendShipperFeeChangeEmail(null, updatedCustomer, "fname lname"));
            }
 public void Empty()
 {
     _svc = BuildService();
     _svc.ValidateCustomerOrderType(new CustomerProfileData());
 }
 public void Null()
 {
     _svc = BuildService();
     _svc.ValidateCustomerOrderType(null);
 }