コード例 #1
0
        public void Convert_When_RtfFileNotFound_Then_NullIsRetuned()
        {
            RtfToPdfConverter converter   = new RtfToPdfConverter();
            string            newFilePath = converter.Convert("test.rtf", "Temp");

            Assert.That(newFilePath, Is.Null);
        }
コード例 #2
0
        public void Convert_When_RtfFileIsFound_Then_NewFilePathIsReturned()
        {
            RtfToPdfConverter converter   = new RtfToPdfConverter();
            string            root        = Path.GetDirectoryName(Path.GetDirectoryName(TestContext.CurrentContext.TestDirectory));
            string            newFilePath = converter.Convert(Path.Combine(root, "Samples\\sample.rtf"), Path.Combine(root, "Temp"));

            Assert.That(newFilePath, Is.Not.Null);
            Assert.That(Path.GetExtension(newFilePath), Is.EqualTo(".pdf"));
        }
コード例 #3
0
        public void Convert_When_RtfDestinationPathDoesNotExist_Then_DirectoryIsCreated()
        {
            string            currentDateSpan = DateTime.Now.Ticks.ToString();
            RtfToPdfConverter converter       = new RtfToPdfConverter();
            string            root            = Path.GetDirectoryName(Path.GetDirectoryName(TestContext.CurrentContext.TestDirectory));

            Assert.That(Directory.Exists(Path.Combine(root, "Temp" + currentDateSpan)), Is.False);
            converter.Convert(Path.Combine(root, "Samples\\sample.rtf"), Path.Combine(root, "Temp" + currentDateSpan));
            Assert.That(Directory.Exists(Path.Combine(root, "Temp" + currentDateSpan)), Is.True);
            Directory.Delete(Path.Combine(root, "Temp" + currentDateSpan), true);
        }