Ejemplo n.º 1
0
        public void TestNotificationsOff()
        {
            _activeCommunity = ActiveCommunity.None;

            // Create a member.

            var sender    = _memberAccountsCommand.CreateTestMember(SenderEmailAddress, SenderFirstName, SenderLastName);
            var recipient = _memberAccountsCommand.CreateTestMember(RecipientEmailAddress, RecipientFirstName, RecipientLastName);
            var threadId  = Guid.NewGuid();
            var messageId = Guid.NewGuid();

            // No settings so notification should get through.

            _emailsCommand.TrySend(new MemberMessageSentEmail(recipient, sender, threadId, messageId, MessageSubject, MessageText));
            _emailServer.AssertEmailSent();

            // Turn off.

            var category = _settingsQuery.GetCategory("MemberToMemberNotification");

            _settingsCommand.SetFrequency(recipient.Id, category.Id, Frequency.Never);
            _emailsCommand.TrySend(new MemberMessageSentEmail(recipient, sender, threadId, messageId, MessageSubject, MessageText));
            _emailServer.AssertNoEmailSent();

            // Turn on.

            _settingsCommand.SetFrequency(recipient.Id, category.Id, Frequency.Immediately);
            _emailsCommand.TrySend(new MemberMessageSentEmail(recipient, sender, threadId, messageId, MessageSubject, MessageText));
            _emailServer.AssertEmailSent();
        }
Ejemplo n.º 2
0
        public void TestEmailContents()
        {
            _activeCommunity = ActiveCommunity.None;

            // Create a member.

            Member sender    = _memberAccountsCommand.CreateTestMember(SenderEmailAddress, SenderFirstName, SenderLastName);
            Member recipient = _memberAccountsCommand.CreateTestMember(RecipientEmailAddress, RecipientFirstName, RecipientLastName);
            Guid   threadId  = Guid.NewGuid();
            var    messageId = Guid.NewGuid();

            // Send the email.

            var templateEmail = new MemberMessageSentEmail(recipient, sender, threadId, messageId, MessageSubject, MessageText);

            _emailsCommand.TrySend(templateEmail);

            // Check.

            var email = _emailServer.AssertEmailSent();

            email.AssertAddresses(sender, Return, recipient);
            email.AssertSubject(Subject);
            email.AssertHtmlViewChecks();
            email.AssertHtmlView(GetBody(templateEmail, recipient, GetContent(templateEmail, sender, threadId, messageId)));
            email.AssertNoAttachments();
            AssertCompatibleAddresses(email);
        }
Ejemplo n.º 3
0
        public void TestCommunityToCommunity()
        {
            _activeCommunity = ActiveCommunity.Finsia;

            // Create a member.

            var communitySender    = TestCommunity.LiveInAustralia.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine);
            var communityRecipient = TestCommunity.Finsia.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine);

            var sender    = _memberAccountsCommand.CreateTestMember(SenderEmailAddress, SenderFirstName, SenderLastName, communitySender.Id);
            var recipient = _memberAccountsCommand.CreateTestMember(RecipientEmailAddress, RecipientFirstName, RecipientLastName, communityRecipient.Id);
            var threadId  = Guid.NewGuid();
            var messageId = Guid.NewGuid();

            // Send the email.

            var templateEmail = new MemberMessageSentEmail(recipient, sender, threadId, messageId, MessageSubject, MessageText);

            _emailsCommand.TrySend(templateEmail);

            // Check.

            var email = _emailServer.AssertEmailSent();

            email.AssertAddresses(sender, Return, recipient);
            email.AssertSubject(Subject);
            email.AssertHtmlViewChecks();
            email.AssertHtmlView(GetBody(templateEmail, recipient, GetContent(templateEmail, sender, threadId, messageId)));
            email.AssertNoAttachments();
            AssertCompatibleAddresses(email);
        }
Ejemplo n.º 4
0
        public void TestMemberMonashGsbCommunity()
        {
            // Create a member.

            var community = TestCommunity.MonashGsb.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine);
            var member    = CreateMember(community);

            _activeCommunity = ActiveCommunity.Monash;

            // Create an email verification.

            var emailVerification = new EmailVerification {
                UserId = member.Id, EmailAddress = member.GetBestEmailAddress().Address
            };

            _emailVerificationsCommand.CreateEmailVerification(emailVerification);

            // Send the email.

            var templateEmail = new ActivationEmail(member, emailVerification);

            _emailsCommand.TrySend(templateEmail);

            // Check.

            var email = _emailServer.AssertEmailSent();

            email.AssertAddresses(Return, Return, member);
            email.AssertSubject(GetSubject());
            email.AssertHtmlViewChecks();
            email.AssertHtmlView(GetBody(templateEmail, member, GetContent(templateEmail, member, emailVerification)));
            email.AssertNoAttachments();
            AssertCompatibleAddresses(email);
        }
        public void TestFinsia()
        {
            _activeCommunity = ActiveCommunity.Finsia;

            // Create an employer.

            var employer = _employerAccountsCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestOrganisation(0));

            // Create a member.

            var community   = TestCommunity.Finsia.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine);
            var member      = _memberAccountsCommand.CreateTestMember(0, community.Id);
            var representee = _memberAccountsCommand.CreateTestMember(1);

            var view          = new ProfessionalView(member, null, ProfessionalContactDegree.Contacted, true, false);
            var communication = new RepresentativeContactCandidateEmail(view, NewEmployerEmail, employer, representee, Subject, Content);

            _emailsCommand.TrySend(communication);

            // Check.

            var email = _emailServer.AssertEmailSent();

            email.AssertAddresses(new EmailRecipient(NewEmployerEmail, employer.FullName), Return, member);
            email.AssertSubject(Subject);
            email.AssertViewChecks(MediaTypeNames.Text.Html);
            email.AssertView(MediaTypeNames.Text.Html, GetBody(communication, member, GetContent(member, representee, employer, Content)));
            email.AssertNoAttachments();
            AssertCompatibleAddresses(email);
        }
Ejemplo n.º 6
0
        public override TemplateEmail GeneratePreview(Community community)
        {
            _activeCommunity = ActiveCommunity.None;

            // Create a member.

            var sender    = _memberAccountsCommand.CreateTestMember(SenderEmailAddress, SenderFirstName, SenderLastName);
            var recipient = _memberAccountsCommand.CreateTestMember(RecipientEmailAddress, RecipientFirstName, RecipientLastName, community != null ? community.Id : (Guid?)null);
            var threadId  = Guid.NewGuid();
            var messageId = Guid.NewGuid();

            // Send the email.

            return(new MemberMessageSentEmail(recipient, sender, threadId, messageId, MessageSubject, MessageText));
        }
Ejemplo n.º 7
0
        //set community to active
        public Community ActiveSycamore_Files()
        {
            ActiveCommunity active = new ActiveCommunity();

            return(active.Active_Files(SycamorePersonFile, SycamoreHouseFile, SycamoreApartmentFile, "Sycamore"));
        }
        //set the comunity to active
        public Community ActiveDekalb_Files()
        {
            ActiveCommunity active = new ActiveCommunity();

            return(active.Active_Files(DekalbPersonFile, DekalbHouseFile, DekalbApartmentFile, "Dekalb"));
        }
 public void TestInitialize()
 {
     ActivityContext.Current.Community.Reset();
     _activeCommunity = ActiveCommunity.None;
 }