public void TestSendEmail_Failed()
        {
            var email = new Email
            {
                Sender = string.Empty,
                Recipient = string.Empty,
                Subject = TypeSubject.SalesPricingQuery,
                Body = string.Empty
            };

            bool result;

            try
            {
                email.Send();
                result = true;
            }
            catch (Exception)
            {
                result = false;
            }

            Assert.IsFalse(result);
        }
        public void TestSendEmail_Success()
        {
            var email = new Email
            {
                Sender = TypeSender.SenderTestOne,
                Recipient = TypeRecipient.RecipientTestOne,
                Subject = TypeSubject.SalesPricingQuery,
                Body = string.Empty
            };

            var result = false;

            try
            {
                email.Send();
                result = true;
            }
            catch (Exception)
            {
                throw;
            }

            Assert.IsTrue(result);
        }
        public bool Save()
        {
            bool result;
            var error = string.Empty;
            try
            {
                // Save Sales Pricing Query
                var pricing = new Pricing
                {
                    City = City,
                    Country = Country,
                    Email = Email,
                    FirstName = FirstName,
                    LastName = LastName,
                    Line1 = Line1,
                    Phone = Phone,
                    Postcode = Postcode,
                    PricingProducts = PricingProducts
                };
                _pricingRepository.Insert(pricing);

                // Save each Product selected to Sales Pricing Query
                var modelPp = new PricingProductModel();
                var modelP = new ProductModel();
                var products = string.Empty;
                foreach (var productId in SelectedProductIds)
                {
                    modelPp.IdProduct = int.Parse(productId);
                    modelPp.IdPricing = pricing.Id;
                    modelPp.Save();

                    // Get Product Names from Id to insert into body-message (Email)
                    products += modelP.GetProductById(int.Parse(productId)).Name + ",";
                }


                // Send Email
                var message = string.Format("E-mail from: Sales Pricing Query - Technical Test<br/><br/>" +
                                            "Details:<br/>First Name: {0}<br/>Last Name: {1}<br/>Email: {2}<br/>Phone: {3}<br/><br/>" +
                                            "Address:<br/>Line1: {4}<br/>City: {5}<br/>Postcode: {6}<br/>Country: {7}<br/><br/>" +
                                            "Product:<br>{8}",
                    pricing.FirstName,
                    pricing.LastName,
                    pricing.Email,
                    pricing.Phone,
                    pricing.Line1,
                    pricing.City,
                    pricing.Postcode,
                    pricing.Country,
                    products.Substring(0, products.Length - 1));

                var email = new Email
                {
                    Sender = TypeSender.SenderTestOne,
                    Recipient = TypeRecipient.RecipientTestOne,
                    Subject = TypeSubject.SalesPricingQuery,
                    Body = message
                };
                email.Send();
            }
            catch (Exception ex)
            {
                error = ex.Message;
            }
            finally
            {
                result = (string.IsNullOrEmpty(error));
            }
            return result;
        }