Skip to content

Instantly share code, notes, and snippets.

@rkandas
Last active August 26, 2019 15:14
Show Gist options
  • Save rkandas/66bb1d3fff5631ac419b4a00c7d8e558 to your computer and use it in GitHub Desktop.
Save rkandas/66bb1d3fff5631ac419b4a00c7d8e558 to your computer and use it in GitHub Desktop.
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