Exemplo n.º 1
0
        public IEnumerator FetchTextureAsync_WebRequestFailed_ReturnsNull()
        {
            TextureConstructor textureConstructor = new TextureConstructor(loadPath);

            textureConstructor.TextureLoader = FakeContentLoaderFactory.CreateFakeFailLoader <Texture2D>();

            LogAssert.Expect(LogType.Error, new Regex(@"\w*This is a simulated fail\w*"));

            Task <Texture2D> task = textureConstructor.FetchTextureAsync();

            yield return(AsyncTest.WaitForTask(task));

            Texture2D res = task.Result;

            Assert.Null(res);
        }
Exemplo n.º 2
0
        public IEnumerator FetchTextureAsync_WebRequestSuccessful_ReturnsTexture()
        {
            TextureConstructor textureConstructor = new TextureConstructor(loadPath);
            Texture2D          expected           = new Texture2D(2, 2);

            textureConstructor.TextureLoader = FakeContentLoaderFactory.CreateFakeLoader(expected);

            Task <Texture2D> task = textureConstructor.FetchTextureAsync();

            yield return(AsyncTest.WaitForTask(task));

            Texture2D res = task.Result;

            Assert.NotNull(res);
            Assert.AreEqual(expected.imageContentsHash, res.imageContentsHash);
        }
Exemplo n.º 3
0
        public void TextureConstructor_ConstructorCalled_LoadPathInitialized()
        {
            TextureConstructor textureConstructor = new TextureConstructor(loadPath);

            Assert.AreEqual(loadPath, textureConstructor.LoadPath);
        }
Exemplo n.º 4
0
        public void TextureConstructor_ConstructorCalled_TextureLoaderInitialized()
        {
            TextureConstructor textureConstructor = new TextureConstructor("");

            Assert.IsNotNull(textureConstructor.TextureLoader);
        }