コード例 #1
0
        public void CreateEmail_Action_Fails()
        {
            // Arrange
            var emailDto = TestHelper.EmailDto();

            GenericServiceResponse <bool> fakeResponse = null;

            mockClientServicesProvider.Setup(x => x.Logger).Returns(mockLogger.Object).Verifiable();
            mockClientServicesProvider.Setup(x => x.EmailService.CreateEmail(emailDto)).Returns(fakeResponse).Verifiable();

            var viewModel = new GenericViewModel();

            var action = new CreateEmail <GenericViewModel>(mockClientServicesProvider.Object)
            {
                OnComplete = model => viewModel = model
            };

            // Act
            var result = action.Invoke(emailDto);

            // Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(GenericViewModel));
            Assert.IsNotNull(result.Notifications);
            Assert.IsInstanceOfType(result.Notifications, typeof(NotificationCollection));
            Assert.IsTrue(result.Notifications.Count() == 1);
            Assert.IsTrue(result.HasErrors);
            Assert.IsNotNull(result.Success);
            Assert.IsInstanceOfType(result.Success, typeof(bool));
            Assert.IsFalse(result.Success);
        }
コード例 #2
0
        public void Create(User user)
        {
            var email = new CreateEmail()
            {
                Email = user.Email
            };

            Send(email);
        }
コード例 #3
0
        public async Task <IActionResult> AddEvent()
        {
            var evt = new CreateEmail
            {
                Title     = $"{Faker.Name.First()} - sending emails",
                Message   = Faker.Lorem.Paragraph(5),
                Recipient = Faker.Name.FullName(NameFormats.StandardWithMiddle)
            };
            await _bus.Publish <CreateEmail>(evt);

            return(Ok("Event added"));
        }
コード例 #4
0
        protected void SubmitApplication(object sender, EventArgs e)
        {
            CreateEmail newEmail = new CreateEmail();

            string fname = txt_FName.Text;
            string lname = txt_LName.Text;
            DateTime DOB = DateTime.ParseExact(txt_DOB.Text,
                                               "MM/dd/yyyy",
                                                CultureInfo.InvariantCulture);
            string primaryPhone = txt_Phone.Text;
            string altPhone = txt_altPhone.Text;
            string email = txt_Email.Text;
            string regisID = txt_RegisID.Text;

            // Used for email
            string subject = "New Driver Application Form";
            string body = "A new driver application form has been submitted for " + fname
                + " " + lname + ".";
            //// Driver Type
            //Ejob
            //EOD
            //    SWSP
            //    Vol

            //    // Vehicle Type
            //Vehicle

            bll.NewApplication(false, false, true, true, regisID, fname, lname, "A", DOB, primaryPhone, altPhone, email,
                Models.Driver_Type.Emp_Required, Models.Driver_Status.Active, "DL001234", "CO", DOB, "Geico", "InsPolicyNum", DOB, "*****@*****.**");

            bool success = newEmail.SendEmail("*****@*****.**", subject, body);

            if (success)
            {
                DialogResult result = MessageBox.Show("Your form was successfully submitted and an email " +
                    "was sent to notify your supervisor.",
                    "Success",
                    MessageBoxButtons.OK);

                // Reset fields on the form to the default.
                if (result == DialogResult.OK)
                {
                    ResetForm();
                }
            }
        }
コード例 #5
0
 //create acc
 private void Button1_Click(object sender, EventArgs e)
 {
     if (CreateName != "" && CreatePassword != "" && CreateUsername != "" && CreateEmail != "")
     {
         if (!CreateEmail.Contains("@") && !CreateEmail.Contains("."))
         {
             MessageBox.Show("Wrong e-mail.");
             ResetOwnProperties();
         }
         else
         {
             Main.con.Insert(this);
             MessageBox.Show("You are created your account, now you can log in.");
             ResetOwnProperties();
         }
     }
     else
     {
         MessageBox.Show("You must insert Username, Name, E-mail and Password.");
         ResetOwnProperties();
     }
 }