sharee.bike-App/TestShareeLib/Repository/TestResponseBase.cs
2023-03-08 13:18:54 +01:00

43 lines
1.1 KiB
C#

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());
}
}
}