public void CanGet_AlreadyLoaded_Resource()
        {
            var boot = new Bootstrapper(Create.Stub<IConfigSettings>(),
                                        Create.Stub<ICradiatorView>());
            boot.CreateKernel();

            var skin1 = new Skin("Stack"); // these tests are reliant on xaml file names in the main assembly (Skin folder)
            var skin2 = new Skin("Grid");
            var skin3 = new Skin("StackPhoto");

            Application.ResourceAssembly = Assembly.GetAssembly(typeof (Skin));

            var skinResourceLoader = new SkinResourceLoader();

            var resourceSkin1 = skinResourceLoader.LoadOrGet(skin1);
            var resourceSkin2 = skinResourceLoader.LoadOrGet(skin2);
            var resourceSkin3 = skinResourceLoader.LoadOrGet(skin3);

            Assert.That(skinResourceLoader.LoadOrGet(skin3), Is.SameAs(resourceSkin3));
            Assert.That(skinResourceLoader.LoadOrGet(skin2), Is.SameAs(resourceSkin2));
            Assert.That(skinResourceLoader.LoadOrGet(skin1), Is.SameAs(resourceSkin1));
        }
Beispiel #2
0
        public void CanGet_AlreadyLoaded_Resource()
        {
            var boot = new Bootstrapper(Create.Stub <IConfigSettings>(),
                                        Create.Stub <ICradiatorView>());

            boot.CreateKernel();

            var skin1 = new Skin("Stack");             // these tests are reliant on xaml file names in the main assembly (Skin folder)
            var skin2 = new Skin("Grid");
            var skin3 = new Skin("StackPhoto");

            Application.ResourceAssembly = Assembly.GetAssembly(typeof(Skin));

            var skinResourceLoader = new SkinResourceLoader();

            var resourceSkin1 = skinResourceLoader.LoadOrGet(skin1);
            var resourceSkin2 = skinResourceLoader.LoadOrGet(skin2);
            var resourceSkin3 = skinResourceLoader.LoadOrGet(skin3);

            Assert.That(skinResourceLoader.LoadOrGet(skin3), Is.SameAs(resourceSkin3));
            Assert.That(skinResourceLoader.LoadOrGet(skin2), Is.SameAs(resourceSkin2));
            Assert.That(skinResourceLoader.LoadOrGet(skin1), Is.SameAs(resourceSkin1));
        }
Beispiel #3
0
 public SkinLoader(ICradiatorView view, SkinResourceLoader skinResourceLoader)
 {
     _view = view;
     _skinResourceLoader = skinResourceLoader;
 }