public void TryGetSupportedFormatFromPathFalse() { FormatProcessorBase.ClearFormatProcessorsCache(); string filePath = "file"; var converter = new CommonFormatConverter(); Assert.IsNotNull(converter); ConvertedFormat format; if (!File.Exists(filePath) || string.IsNullOrEmpty(filePath)) { Assert.Throws <ArgumentException>(() => converter.TryGetSupportedFormatFromPath("file", out format)); } else { Assert.IsFalse(converter.TryGetSupportedFormatFromPath("file", out format)); } }
public void TryGetSupportedFormatFromPathException(string filePath) { FormatProcessorBase.ClearFormatProcessorsCache(); var converter = new CommonFormatConverter(); Assert.IsNotNull(converter); ConvertedFormat format; Assert.Throws <ArgumentException>(() => converter.TryGetSupportedFormatFromPath(filePath, out format)); }
public void TryGetSupportedFormatFromPathTrue(ConvertedFormat format) { FormatProcessorBase.ClearFormatProcessorsCache(); var converter = new CommonFormatConverter(); Assert.IsNotNull(converter); using (var processor = converter.CreateFormatProcessor(format)) { Assert.IsNotNull(processor); Assert.IsTrue(converter.ConvertProcessor(processor, $"file.{format}", format)); } ConvertedFormat supportedFormat; Assert.IsTrue(converter.TryGetSupportedFormatFromPath($"file.{format}", out supportedFormat)); Assert.AreEqual(supportedFormat, format); }