sharee.bike-App/TestTINKLib/Fixtures/ObjectTests/Connector/Response/TestResponseBase.cs

44 lines
1.3 KiB
C#
Raw Normal View History

2021-07-12 21:31:46 +02:00
using Newtonsoft.Json;
using NUnit.Framework;
namespace TINK.Repository.Response
{
[TestFixture]
public class TestResponseBase
{
[Test]
public void TestDeserialize()
{
// Deserialize object and verify.
var l_oContainer = CopriCallsMemory.DoAuthorize("javaminister@gmail.com", "javaminister", "HwId1000000000000");
// Check first entry.
Assert.AreEqual("authorization", l_oContainer.response);
Assert.AreEqual("4da3044c8657a04ba60e2eaa753bc51a", l_oContainer.authcookie);
Assert.AreEqual("OK", l_oContainer.response_state);
}
[Test]
public void TestToString()
{
var l_oResponse = JsonConvert.DeserializeObject<ResponseBase>(@"
{
""response_state"": ""OhMyState"",
""response"": ""HabGsagt"",
""response_text"": ""die Antwort"",
""authcookie"": ""lecker1"",
""copri_version"":""123""
}");
Assert.AreEqual(
"Response state is \"OhMyState\", " +
$"auth cookie is \"lecker1\" and response is \"die Antwort\", " +
$"code \"HabGsagt\""+
$"response text \"die Antwort\".",
l_oResponse.ToString());
}
}
}