- Home /
Question by
santiihoyos · Aug 09, 2016 at 05:25 PM ·
testingtest
How to implement UNET Test?
Hi, I am trying to implement a test for the UNET Connection, for example:
[Test]
public void UnetIsOn_OkSiAlListarApareceSalaCreada()
{
EditorSceneManager.OpenScene("Assets/Scenes/Menu.unity");
GameObject obj = GameObject.Find("NetworkManager");
manager = obj.GetComponent<NetworkManager2>();
manager.StartMatchMaker();
manager.matchMaker.CreateMatch("paridaTest123456789", 10, true, "", "", "", 0, 0, (bool success, string extendedInfo, MatchInfo responseData) =>
{
Assert.NotNull(responseData);
});
manager.matchMaker.ListMatches(0, 1000, "", true, 0, 0, (bool success, string extendedInfo, System.Collections.Generic.List<MatchInfoSnapshot> respu) =>
{
Assert.NotNull(respu, "Error in ListMatches!");
Assert.True(respu[0].name.ToString() == "paridaTest123456789", "The match dont exist!");
});
}
The problem is that the callback are asynchronous and the test passes always, how i can wait the callback end?
Thank you so much and sorry by my english is not very good.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612090450im_/https://answers.unity.com/themes/thub/images/avi.jpg)