public void TestThrowOnLoadAssetBeforeInitialization() {
   GameServiceContainer gameServices = new GameServiceContainer();
   MockedGraphicsDeviceService mockedGraphics = new MockedGraphicsDeviceService();
   gameServices.AddService(typeof(IGraphicsDeviceService), mockedGraphics);
   using(
     TestSharedContentManager contentManager = new TestSharedContentManager(gameServices)
   ) {
     Assert.Throws<InvalidOperationException>(
       delegate() { contentManager.Load<BadImageFormatException>("I'm a funny asset"); }
     );
   }
 }
    public void TestLoadAsset() {
      GameServiceContainer gameServices = new GameServiceContainer();
      MockedGraphicsDeviceService mockedGraphics = new MockedGraphicsDeviceService();
      gameServices.AddService(typeof(IGraphicsDeviceService), mockedGraphics);
      using(
        TestSharedContentManager contentManager = new TestSharedContentManager(gameServices)
      ) {
        contentManager.Initialize();

        Assert.IsNull(contentManager.LastLoadedAsset);
        contentManager.Load<BadImageFormatException>("I'm a funny asset");
        Assert.AreEqual("I'm a funny asset", contentManager.LastLoadedAsset);
      }
    }
    public void TestUnloadContent() {
      GameServiceContainer gameServices = new GameServiceContainer();
      MockedGraphicsDeviceService mockedGraphics = new MockedGraphicsDeviceService();
      gameServices.AddService(typeof(IGraphicsDeviceService), mockedGraphics);

      using(IDisposable keeper = mockedGraphics.CreateDevice()) {
        using(
          TestSharedContentManager contentManager = new TestSharedContentManager(gameServices)
        ) {
          contentManager.Initialize();

          Assert.AreEqual(0, contentManager.UnloadCallCount);

          contentManager.Unload();

          Assert.AreEqual(1, contentManager.UnloadCallCount);
        }
      }
    }