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); }
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); }
public void TextureConstructor_ConstructorCalled_LoadPathInitialized() { TextureConstructor textureConstructor = new TextureConstructor(loadPath); Assert.AreEqual(loadPath, textureConstructor.LoadPath); }
public void TextureConstructor_ConstructorCalled_TextureLoaderInitialized() { TextureConstructor textureConstructor = new TextureConstructor(""); Assert.IsNotNull(textureConstructor.TextureLoader); }