private static void DeserializeCompileAndLoad <T>(string file, Action <T> doAsserts) { var result = Deserialize(file, doAsserts); var xnbStream = new MemoryStream(); #if XNA // In MS XNA the ContentCompiler is completely internal, so we need // to use just a little reflection to get access to what we need. const BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public; var ctor = typeof(ContentCompiler).GetConstructors(flags)[0]; var compiler = (ContentCompiler)ctor.Invoke(null); var compileMethod = typeof(ContentCompiler).GetMethod("Compile", flags); compileMethod.Invoke(compiler, new object[] { xnbStream, result, TargetPlatform.Windows, GraphicsProfile.Reach, false, Directory.GetCurrentDirectory(), "referenceRelocationPath" }); #else var compiler = new ContentCompiler(); compiler.Compile(xnbStream, result, TargetPlatform.Windows, GraphicsProfile.Reach, false, "rootDirectory", "referenceRelocationPath"); #endif var content = new TestContentManager(xnbStream); var loaded = content.Load <T>("Whatever"); doAsserts(loaded); }
public void Init() { _contentManager = new TestContentManager(); _level = new Level(); _goomba = new Goomba(0, 0, _level, _contentManager); _level.ToAddGameObject(_goomba); _level.UpdateLevel(); }
public void Init() { _contentManager = new TestContentManager(); _level = new Level(); _mario = new Mario(0, 0, _level, _contentManager); _level.ToAddGameObject(_mario); _level.UpdateLevel(); }
public void Init() { _contentManager = new TestContentManager(); _level = new Level(); _mysteryBlock = new MysteryBlock(0, 0, typeof(Coin), _level, _contentManager); _level.ToAddGameObject(_mysteryBlock); _level.UpdateLevel(); }
public void Init() { _contentManager = new TestContentManager(); _level = new Level(); _Mushroom = new Mushroom(0, 0, _level, _contentManager); _level.ToAddGameObject(_Mushroom); _level.UpdateLevel(); }
public void Init() { _contentManager = new TestContentManager(); _level = new Level(); _fallingSpike = new FallingSpike(0, 0, _level, _contentManager); _level.ToAddGameObject(_fallingSpike); _level.UpdateLevel(); }
public void Init() { _contentManager = new TestContentManager(); _level = new Level(); _shell = new Shell(0, 0, _level, _contentManager); _level.ToAddGameObject(_shell); _level.UpdateLevel(); }
public void Init() { _contentManager = new TestContentManager(); _level = new Level(); _koopa = new Koopa(0, 0, _level, _contentManager); _level.ToAddGameObject(_koopa); _level.UpdateLevel(); }
public void Init() { _contentManager = new TestContentManager(); _level = new Level(); _floor = new TransFloor(3, 3, 3, 3, _level, _contentManager); _level.ToAddGameObject(_floor); _level.UpdateLevel(); _spriteBatch = new SpriteBatch(new TestGraphicsDeviceService().GraphicsDevice); }
public void Init() { _contentManager = new TestContentManager(); _level = new Level(); _mario = new Mario(3, 3, _level, _contentManager); _coin = new Coin(1, 1, _level, _contentManager); _level.ToAddGameObject(_mario); _level.ToAddGameObject(_coin); _level.UpdateLevel(); }
public void ReadAllLines() { var file = Path.Combine(TestContentManager.GetContentPath(), "text.txt"); var encoding = Encoding.Default; const int takeLines = 3; var lines = File.ReadAllLines(file, encoding).Take(takeLines); var streamParser = new LineTextParser(UnitLineParser.Instance); int linesTaken = 0; var lineStream = Observable.Using(() => new StreamReader(file, encoding), reader => streamParser.ExtractWords(reader).Do(line => linesTaken++).Take(takeLines)); var lines2 = lineStream.ToList().Wait(); Assert.That(lines2, Is.EquivalentTo(lines)); Assert.That(linesTaken, Is.LessThanOrEqualTo(takeLines)); }
void CompileAndLoadAssets <T>(T data, Action <T> validation) { foreach (var platform in Platforms) { foreach (var gfxProfile in GraphicsProfiles) { foreach (var compress in CompressContents) { using (var xnbStream = new MemoryStream()) { Compiler.Compile(xnbStream, data, platform, gfxProfile, compress, "", ""); using (var content = new TestContentManager(xnbStream)) { var result = content.Load <T>("foo"); validation(result); } } } } } }
public void Init() { _contentManager = new TestContentManager(); _level = new Level(); _cloudBlock = new CloudBlock(1, 1, _level, _contentManager); }
public void Init() { _contentManager = new TestContentManager(); _level = new Level(); _stoneBlock = new StoneBlock(1, 1, _level, _contentManager); }
public LineStreamParserTests() { largeContentPath = TestContentManager.PrepareLargeTextFile(); }
public void Init() { _contentManager = new TestContentManager(); _level = new Level(); _muncher = new Muncher(1, 1, _level, _contentManager); }
public void Init() { _gameObjectFactory = new GameObjectFactory(); _contentManager = new TestContentManager(); _level = new Level(); }
protected static IList <string> CopyContentFilesTo(string pattern, string path) { return(TestContentManager.CopyContentFilesTo(pattern, path)); }