public ActionResult Create(CustMailMessage custmailmessage)
        {
            DefaultMembershipProvider membersShip = new DefaultMembershipProvider();
            int i = 0;

            membersShip.FindUsersByName(User.Identity.Name, 1, 1, out i);
            if (ModelState.IsValid)
            {
                string Editor = Method.GetLogonUserId(Session, this, User.Identity.Name.ToUpper());
                custmailmessage.Sender = db.vuser.Where(x => x.UserName.Equals(Editor)).FirstOrDefault().Email;
                List <string> Receiver  = Method.StringToList(custmailmessage.Receiver);
                const string  mediafile = @"http://barcelonamedia.azurewebsites.net/MediaFile/ShareFileUser";
                const string  space     = " ";
                string        Body      = custmailmessage.Body + space + mediafile;
                custmailmessage.IsSuccess = Method.SendMail(Receiver, custmailmessage.Subject, Body);
                SendNotificationAsync(custmailmessage.Receiver, custmailmessage.Subject, Body);

                custmailmessage.Id  = Guid.NewGuid();
                custmailmessage.cdt = DateTime.Now;
                db.custmailmessage.Add(custmailmessage);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }

            return(View(custmailmessage));
        }
        public void ShouldReturnUserIfValid()
        {
            // Arrange
            DefaultMembershipProvider membership = new DefaultMembershipProvider(m_repository.Object, m_encryptor.Object);

            // Act
            IUser user = membership.Validate(MockUsers.CreateMockUserCredentials("*****@*****.**", "password"));

            // Assert
            Assert.AreNotEqual(null, user);
            Assert.AreEqual(m_user.Credentials.Email, user.Credentials.Email);
        }
        public void ShouldThrowIfUserDoesNotExist()
        {
            // Arrange
            DefaultMembershipProvider membership = new DefaultMembershipProvider(m_repository.Object, m_encryptor.Object);

            // Act
            try
            {
                IUser user = membership.Validate(MockUsers.CreateMockUserCredentials("*****@*****.**", "password"));
            }
            catch (AuthenticationException)
            {
                // expected, just return
                return;
            }

            // Assert
            Assert.Fail("Expected AuthenticationException");
        }