protected override void ConfigureApplicationContainer(TinyIoCContainer container) { base.ConfigureApplicationContainer(container); // The CLR (not mono) does lazy loading of external assemblies and // will retrieve them on demand when you use their types. the // downside of this is that the razor template can't compile // because the assembly hasn't been loaded yet, so we use a type // from the assembly to force it to be loaded. #if !__MonoCS__ var a = new TradeStats.PowerStats("a", 1, 1, 1, 1, 1, 1); #endif string exe = Assembly.GetEntryAssembly().Location; string exeDir = Path.GetDirectoryName(exe); string tmplFile = Path.Combine(exeDir, "template.html"); Templater tmpl = new Templater(tmplFile); container.Register<ITemplate>(tmpl); string gamedir = Path.Combine(exeDir, "..", "games"); if (!Directory.Exists(gamedir)) Directory.CreateDirectory(gamedir); var gen = new IncrementIdGenerator(gamedir); container.Register<IIdGenerator>(gen); var module = new SavegameStorage(gamedir); container.Register<SavegameStorage>(module); }
public void TemplateRendersSuccessfully() { #if !__MonoCS__ var a = new TradeStats.PowerStats("a", 1, 1, 1, 1, 1, 1); #endif var tmpl = new Templater("template.html"); var save = new Save(); save.Player = "MEE"; string contents = tmpl.Render(StatsModule.Aggregate(save)); StringAssert.Contains("MEE", contents); }