ContentTypeIdentifierTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Content.Xml.Tests ContentTypeIdentifierTests

Namespace: DeltaEngine.Content.Xml.Tests
Assembly: DeltaEngine.Content.Xml.Tests (in DeltaEngine.Content.Xml.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class ContentTypeIdentifierTests

The ContentTypeIdentifierTests type exposes the following members.

Constructors

  NameDescription
Public methodContentTypeIdentifierTests
Initializes a new instance of the ContentTypeIdentifierTests class
Top
Methods

  NameDescription
Public methodCheckExtensionOfLocalFilePathIfUsingCompressedOrUncompressedFileFormat
Public methodCheckNonExistingFilePathShouldReturnUncompressedFile
Public methodContentTypeOfUndefinedRootElementsIsXml
Public methodContentTypeOfXmlFileDependsOnRootElement
Public methodThrowExceptionIfInvalidXmlData
Public methodUniqueFileExtensionShouldHaveRespectiveContentTypeAssociated
Public methodUnsupportedTypeReturnsJustStoreInRelease
Top
Examples

[Test]
public void ContentTypeOfUndefinedRootElementsIsXml()
{
    string xmlData = CreateXmlDataFromTag("Test");
    ContentType type = GetContentTypeOfXmlData(xmlData);
    Assert.AreEqual(ContentType.Xml, type);
}
[Test]
public void ThrowExceptionIfInvalidXmlData()
{
    const string InvalidXmlData = "<Opening></Closing>";
    Assert.Throws<XmlException>(() => GetContentTypeOfXmlData(InvalidXmlData));
}
[Test]
public void UnsupportedTypeLogsAndThrowsExceptionInDebug()
{
    Assert.Throws<ContentTypeIdentifier.UnsupportedContentFileFoundCannotParseType>(
        () => ContentTypeIdentifier.ExtensionToType(UnsupportedFileName));
}
[Test]
public void UnsupportedTypeReturnsJustStoreInRelease()
{
    Assert.AreEqual(ContentType.JustStore,
        ContentTypeIdentifier.ExtensionToType(UnsupportedFileName));
}
[Test]
public void CheckExtensionOfLocalFilePathIfUsingCompressedOrUncompressedFileFormat()
{
    Assert.IsFalse(ContentTypeIdentifier.IsUncompressedFile("Image.jpg"));
    Assert.IsTrue(ContentTypeIdentifier.IsUncompressedFile("TextDocument.txt"));
}
[Test]
public void CheckNonExistingFilePathShouldReturnUncompressedFile()
{
    Assert.IsTrue(ContentTypeIdentifier.IsUncompressedFile(""));
    Assert.IsTrue(ContentTypeIdentifier.IsUncompressedFile(null));
}
See Also