public IEnumerator checkBehaviorGoedleWebRequest() { _gdb.text.Returns(_strategy_string); _gw.isHttpError.Returns(false); _gw.isNetworkError.Returns(false); _gio_http_client.requestStrategy(_url, _gio_object, _gw, _gdb, _staging); int c = 0; while (_gio_object.strategy == null || c < 120) { yield return(null); c++; } _gw.Received(2).SendWebRequest(); Assert.AreEqual(_gio_object.strategy["config"]["scenario"].Value, "seashore"); Assert.AreEqual(_gio_object.strategy["config"]["wind_speed"].Value, "fast"); Assert.AreEqual(_gio_object.strategy["id"].Value, "1"); }
public void checkBehaviorGoedleWebRequestPOST() { _gio_object = new GoedleAnalytics(_api_key, _app_key, _user_id, _app_version, _GA_TRACKIND_ID, _app_name, _GA_CD_1, _GA_CD_2, _GA_CD_EVENT, _gio_http_client, _gw, _guh, _staging, _tracking); _gw.unityWebRequest.Returns(new UnityWebRequest()); _gw.isHttpError.Returns(false); _gw.isNetworkError.Returns(false); string authentification = "12345"; _gio_http_client.sendPost(_url, authentification, _gw, _guh, _staging); _gw.Received(2).SendWebRequest(); _gw.Received(2).SetRequestHeader(Arg.Is <string>("Content-Type"), Arg.Is <string>("application/json")); _gw.Received(1).SetRequestHeader(Arg.Is <string>("Authorization"), Arg.Is <string>("12345")); _gw.Received(2).SetRequestHeader(Arg.Is <string>("Authorization"), Arg.Any <string>()); }