Beispiel #1
0
        public void ReadTemplateFile_Should_Read_CultureUI_Textfile_Contents()
        {
            // Arrange
            _applicationSettings.EmailTemplateFolder = AppDomain.CurrentDomain.BaseDirectory;
            string expectedContents = DateTime.UtcNow.ToString();
            string cultureDir       = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "fr-FR");

            if (!Directory.Exists(cultureDir))
            {
                Directory.CreateDirectory(cultureDir);
            }

            string cultureFilePath = Path.Combine(cultureDir, "emailtemplate.txt");

            Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR");

            File.WriteAllText(cultureFilePath, expectedContents);
            EmailTemplateStub emailTemplate = new EmailTemplateStub(_applicationSettings, _siteSettings, _emailClientMock);

            // Act
            string actualContents = emailTemplate.ReadTemplateFile("emailtemplate.txt");

            // Assert
            Assert.That(actualContents, Is.EqualTo(expectedContents));
        }
Beispiel #2
0
        public void ReadTemplateFile_Should_Read_Textfile_Contents()
        {
            // Arrange
            _applicationSettings.EmailTemplateFolder = AppDomain.CurrentDomain.BaseDirectory;
            string expectedContents = DateTime.UtcNow.ToString();
            string path             = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "emailtemplate.txt");

            File.WriteAllText(path, expectedContents);
            EmailTemplateStub emailTemplate = new EmailTemplateStub(_applicationSettings, _siteSettings, _emailClientMock);

            // Act
            string actualContents = emailTemplate.ReadTemplateFile("emailtemplate.txt");

            // Assert
            Assert.That(actualContents, Is.EqualTo(expectedContents));
        }