예제 #1
0
 public void SetBoxartFull_Test()
 {
     string testKey = Guid.NewGuid().ToString();
     IGameMediaCache mediaCache = new GameMediaCache(testKey);
     string tempFileName = Path.GetTempFileName();
     using (Stream stream = TestUtilities.GetResource("GameCache.600x600.gif"))
     {
         Image image = Image.FromStream(stream);
         image.Save(tempFileName);
         image.Dispose();
         mediaCache.SetBoxartFull(new Uri(tempFileName));
     }
     Assert.NotNull(mediaCache.GetBoxartFullImage());
 }
예제 #2
0
 public void GameMediaCacheCreation_Test()
 {
     string testKey = Guid.NewGuid().ToString();
     IGameMediaCache mediaCache = new GameMediaCache(testKey);
     Assert.True(Directory.Exists(Path.Combine(mediaCache.RootPath, mediaCache.CacheKey)));
 }
예제 #3
0
 public void SetGameVideo_Test(string fileName)
 {
     string testKey = Guid.NewGuid().ToString();
     IGameMediaCache mediaCache = new GameMediaCache(testKey);
     string tempFileName = Path.GetTempFileName() + Path.GetExtension(fileName);
     using (Stream stream = TestUtilities.GetResource($"GameCache.{fileName}"))
     {
         using (FileStream writeStream = new FileStream(tempFileName, FileMode.Create))
         {
             stream.Seek(0, SeekOrigin.Begin);
             stream.CopyTo(writeStream);
         }
     }
     Uri musicUri = new Uri(tempFileName);
     mediaCache.SetGameVideo(musicUri);
     Assert.Equal(Path.GetExtension(fileName), Path.GetExtension(mediaCache.GameVideoFileName));
 }