Ejemplo n.º 1
0
        public void GetSubjectReturnsSubject()
        {
            var testOptions = Options.Create <NoticeEmailOptions> (new NoticeEmailOptions());
            var parameters  = new Dictionary <string, string> ()
            {
                { "Subject", "subject" }
            };

            var expected = parameters["Subject"];

            var cut    = new NoticeEmail(testOptions, null, null, fileSystem);
            var actual = cut.GetSubject(parameters);

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 2
0
        public void GetSubjectReturnsSubjectThatLooksOKWhenAParameterIsMissing()
        {
            var testOptions = Options.Create <NoticeEmailOptions> (new NoticeEmailOptions());
            var parameters  = new Dictionary <string, string> ()
            {
                { "Subject", "%%Reminder%%Subject with %%Replacement1%% and %%Replacement2%%" }, { "Replacement1", "replacement1" }, { "Replacement2", "replacement2" }
            };

            var expected = "Subject with replacement1 and replacement2";

            var cut    = new NoticeEmail(testOptions, null, null, fileSystem);
            var actual = cut.GetSubject(parameters);

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 3
0
        public void GetSubjectThrowExceptionIfThereIsNotSubjectParameter()
        {
            var testOptions = Options.Create <NoticeEmailOptions> (new NoticeEmailOptions());
            var parameters  = new Dictionary <string, string> ();

            var  expected = typeof(EmailServiceException);
            Type actual   = null;

            try
            {
                var cut = new NoticeEmail(testOptions, null, null, fileSystem);
                cut.GetSubject(null);
            }
            catch (Exception ex)
            {
                actual = ex.GetType();
            }
            Assert.Equal(expected, actual);
        }