public void CreateInstanceOfTypeWithCtorParamsShouldThrowException() { Assert.Throws <MissingMethodException>( () => BinaryDataLoader.CreateAndLoad(typeof(ClassThatRequiresConstructorParameter), new BinaryReader(new MemoryStream()), new Version(0, 0))); }
public void LoadUnknownTypeShouldThrowException() { Assert.Throws <Exception>( () => BinaryDataLoader.CreateAndLoad(typeof(Vector2D), new BinaryReader(new MemoryStream()), new Version(0, 0))); }
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(); }