Example #1
0
        public virtual void Setup()
        {
            //ViewFactory.Current = new MockViewFactory();
            Logger.Current              = new MockLogger();
            FileSystem.Current          = new MockFileSystem();
            EnvironmentSettings.Current = new MockEnvironmentSettings();
            TimeService.Current         = new MockTimeService();
            Registry.Current            = new MockRegistry();
            IdentityGenerator.Current   = new MockIdentityGenerator();
            HttpRequestManager.Current  = new MockHttpRequestManager();
            Config.Current              = new MockConfig();
            ArchiveFactory.Current      = new MockArchiveFactory();

            //managers relevant to installing and installing games.
            GameExplorer.Current    = new MockGameExplorer();
            IconManager.Current     = new MockIconManager();
            ProcessManager.Current  = new MockProcessManager();
            ShortcutManager.Current = new MockShortcutManager();

            ((MockRegistry)Registry.Current).AddFakeKey(BaseRegistryKey.LocalMachine, new MockRegistryKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"));

            MockDirectory volumeRoot = MockFileSystem.AddVolumeRoot("C:");

            volumeRoot.AddDirectory("temp");
            MockDirectory documentsDir = volumeRoot.AddDirectory("Documents and Settings");

            documentsDir.AddDirectory("All Users").AddDirectory("Application Data");
            MockDirectory userDir = documentsDir.AddDirectory("user");

            userDir.AddDirectory("Local Settings").AddDirectory("Application Data");
            userDir.AddDirectory("desktop");
            userDir.AddDirectory("start menu");
            volumeRoot.AddDirectory("Documents and Settings").AddDirectory("All Users").AddDirectory("Application Data");

            MockDirectory mgdfDirectory = volumeRoot.AddDirectory("program files").AddDirectory("MGDF");

            mgdfDirectory.AddDirectory("game");

            Resources.InitUpdaterDirectories();
        }
Example #2
0
        void CreateDirectory(MockDirectory parent, Span <string> dirs)
        {
            if (dirs.Length == 0)
            {
                return;
            }
            MockDirectory cur;

            if (!parent.TryGetDirectory(dirs[0], out cur))
            {
                cur = new MockDirectory();
                parent.AddDirectory(dirs[0], cur);
            }
            CreateDirectory(cur, dirs.Slice(1));
        }
Example #3
0
        public void LoadDependenciesFile()
        {
            const string json = @"{
	""dependencies"":[
		{ ""command"": ""vc2013redist_x86.exe"", ""arguments"":""/q"" }
	]
}";

            MockDirectory depsDirectory = ((MockDirectory)MockFileSystem.GetDirectory(EnvironmentSettings.Current.AppDirectory));

            depsDirectory = depsDirectory.AddDirectory("dependencies");
            depsDirectory.AddFile("dependencies.json", json);
            var deps = new FrameworkDependencies(Resources.DependenciesFile);

            Assert.AreEqual(true, deps.IsValid);
            Assert.AreEqual(0, deps.ErrorCollection.Count);
            Assert.AreEqual(1, deps.Dependencies.Count);
            Assert.AreEqual("/q", deps.Dependencies["vc2013redist_x86.exe"]);
        }