Last active
August 26, 2019 15:14
-
-
Save rkandas/66bb1d3fff5631ac419b4a00c7d8e558 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AssetSpawnerTest | |
{ | |
[UnityTest] | |
public IEnumerator Should_InstantiateObject_When_GivenStringHasNameAndPosition() | |
{ | |
//given | |
// mock the CSV reader | |
var reader = Substitute.For<ICsvReader>(); | |
reader.ReadNextLine().Returns("CubeX,2,3,3"); | |
String expectedName = "CubeX"; | |
String csvString = reader.ReadNextLine(); | |
Vector3 expectedCoordinate = new Vector3(2f,3f,3f); | |
//when | |
AssetSpawner assetSpawner = new AssetSpawner(); | |
assetSpawner.createAGameObjectFromString(csvString); | |
//then | |
GameObject obj = GameObject.Find(expectedName); | |
Assert.IsNotNull(obj); | |
Assert.AreEqual(expectedCoordinate, obj.transform.position); | |
yield return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment