Inheritance Hierarchy
DeltaEngine.Content.Tests BinaryDataWithContentLoaderTests
Namespace: DeltaEngine.Content.Tests
Assembly: DeltaEngine.Content.Tests (in DeltaEngine.Content.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The BinaryDataWithContentLoaderTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() | BinaryDataWithContentLoaderTests | Initializes a new instance of the BinaryDataWithContentLoaderTests class |
Methods
Name | Description | |
---|---|---|
![]() | LoadContentWithoutNameShouldThrowUnableToLoadContentDataWithoutName | |
![]() | TestLoadContentType |
Examples
[Test] public void TestLoadContentType() { ContentLoader.Use<MockContentLoader>(); const string ContentName = "SomeXml"; var instance = new ObjectWithContent(ContentLoader.Load<MockXmlContent>(ContentName)); var stream = BinaryDataExtensions.SaveDataIntoMemoryStream(instance); var loadedInstance = BinaryDataExtensions.LoadDataWithKnownTypeFromMemoryStream<ObjectWithContent>(stream); Assert.AreEqual(instance.xmlContent, loadedInstance.xmlContent); ContentLoader.DisposeIfInitialized(); }
[Test] public void LoadContentWithoutNameShouldThrowUnableToLoadContentDataWithoutName() { var stream = new MemoryStream(); var writer = new BinaryWriter(stream); writer.Write(true); writer.Write(string.Empty); ContentLoader.Use<MockContentLoader>(); stream.Position = 0; var reader = new BinaryReader(stream); var version = Assembly.GetExecutingAssembly().GetName().Version; Assert.That( () => BinaryDataLoader.CreateAndLoad(typeof(MockXmlContent), reader, version), Throws.Exception.With.InnerException.TypeOf <BinaryDataLoader.UnableToLoadContentDataWithoutName>()); ContentLoader.DisposeIfInitialized(); }
See Also