public void DownloadGameMetadataTest()
        {
            var originLib     = new OriginLibrary();
            var existingStore = originLib.DownloadGameMetadata("OFB-EAST:60108");

            Assert.IsNotNull(existingStore.StoreDetails);
            Assert.IsNotNull(existingStore.Image.Data);
        }
        public void GetPathFromPlatformPathTest()
        {
            var originLib = new OriginLibrary();
            var path      = originLib.GetPathFromPlatformPath(@"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\PowerShell\\3\\PowerShellEngine\\ApplicationBase]\\powershell.exe");

            Assert.IsTrue(File.Exists(path));

            path = originLib.GetPathFromPlatformPath(@"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\PowerShell\\3\\PowerShellEngine\\ApplicatioBase]\\powershell.exe");
            Assert.IsTrue(string.IsNullOrEmpty(path));
        }
Esempio n. 3
0
        public void InstallerDataDeserialization()
        {
            var data = OriginLibrary.GetGameInstallerData(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources"));

            Assert.AreEqual(2, data.runtime.launchers.Count);
            Assert.AreEqual(true, data.runtime.launchers[1].requires64BitOS);

            data = OriginLibrary.GetGameInstallerData(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "sub", "sub2"));
            Assert.AreEqual(2, data.runtime.launchers.Count);
            Assert.AreEqual(true, data.runtime.launchers[1].requires64BitOS);
        }
        public void GetInstalledGamesCacheTest()
        {
            var originLib = new OriginLibrary();

            OriginPaths.CachePath = Path.Combine(PlayniteTests.TempPath, "origincache");
            FileSystem.CreateDirectory(OriginPaths.CachePath, true);

            var games      = originLib.GetInstalledGames(true);
            var cacheFiles = Directory.GetFiles(OriginPaths.CachePath, "*.json");

            Assert.IsTrue(cacheFiles.Count() > 0);
        }
        public void GetInstalledGamesTest()
        {
            var originLib = new OriginLibrary();
            var games     = originLib.GetInstalledGames(false);

            Assert.AreNotEqual(0, games.Count);

            var game = games[0];

            Assert.AreEqual(Provider.Origin, game.Provider);
            Assert.IsTrue(!string.IsNullOrEmpty(game.Name));
            Assert.IsTrue(!string.IsNullOrEmpty(game.ProviderId));
            Assert.IsTrue(Directory.Exists(game.InstallDirectory));
            Assert.IsNotNull(game.PlayTask);

            foreach (Game g in games)
            {
                if (g.PlayTask.Type == GameTaskType.File)
                {
                    Assert.IsTrue(File.Exists(g.ResolveVariables(g.PlayTask.Path)));
                }
            }
        }