mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-21 21:46:27 +02:00
Manually merged.
This commit is contained in:
parent
d5832e010e
commit
c7c9f252af
112 changed files with 1127 additions and 352 deletions
|
@ -1059,9 +1059,29 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
/// COPRI response shortened, part not belonging to user_miniquery discarded.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestCreateMiniSurvey_Co2Saving()
|
||||
{
|
||||
var response = JsonConvert.DeserializeObject<ResponseContainer<DoReturnResponse>>(@"
|
||||
{
|
||||
""shareejson"" : {
|
||||
""co2saving"" : ""Einsparung: 1,95 kg CO2 und 3,00 EUR bei einer Strecke von 10 KM""
|
||||
}
|
||||
}");
|
||||
|
||||
var bookingFinshed = response.shareejson.Create();
|
||||
|
||||
Assert.That(
|
||||
bookingFinshed.Co2Saving,
|
||||
Is.EqualTo("Einsparung: 1,95 kg CO2 und 3,00 EUR bei einer Strecke von 10 KM"));
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// COPRI response shortened, part not belonging to user_miniquery discarded.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestCreateMiniSurvey()
|
||||
{
|
||||
var response = JsonConvert.DeserializeObject<ResponseContainer<ReservationCancelReturnResponse>>(@"
|
||||
var response = JsonConvert.DeserializeObject<ResponseContainer<DoReturnResponse>>(@"
|
||||
{
|
||||
""shareejson"" : {
|
||||
""user_miniquery"" : {
|
||||
|
@ -1108,26 +1128,26 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
|
||||
");
|
||||
|
||||
var survey = response.shareejson.Create();
|
||||
var bookingFinished = response.shareejson.Create();
|
||||
|
||||
Assert.That(
|
||||
survey,
|
||||
bookingFinished,
|
||||
Is.Not.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Title,
|
||||
bookingFinished.MiniSurvey.Title,
|
||||
Is.EqualTo("Bitte unterstützen Sie unsere Begleitforschung"));
|
||||
|
||||
Assert.That(
|
||||
survey.Subtitle,
|
||||
bookingFinished.MiniSurvey.Subtitle,
|
||||
Is.EqualTo("Ihre drei Antworten werden anonym gespeichert."));
|
||||
|
||||
Assert.That(
|
||||
survey.Footer,
|
||||
bookingFinished.MiniSurvey.Footer,
|
||||
Is.EqualTo("Herzlichen Dank und viel Spaß bei der nächsten Fahrt!"));
|
||||
|
||||
Assert.That(
|
||||
survey.Questions.Count,
|
||||
bookingFinished.MiniSurvey.Questions.Count,
|
||||
Is.EqualTo(3));
|
||||
}
|
||||
|
||||
|
@ -1137,7 +1157,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestCreateMiniSurvey_Null()
|
||||
{
|
||||
var response = JsonConvert.DeserializeObject<ResponseContainer<ReservationCancelReturnResponse>>(@"
|
||||
var response = JsonConvert.DeserializeObject<ResponseContainer<DoReturnResponse>>(@"
|
||||
{
|
||||
""shareejson"" : {
|
||||
}
|
||||
|
@ -1145,22 +1165,26 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
|
||||
");
|
||||
|
||||
var survey = response.shareejson.Create();
|
||||
var bookingFinshed = response.shareejson.Create();
|
||||
|
||||
Assert.That(
|
||||
survey,
|
||||
bookingFinshed,
|
||||
Is.Not.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Title,
|
||||
bookingFinshed.MiniSurvey.Questions.Count,
|
||||
Is.EqualTo(0));
|
||||
|
||||
Assert.That(
|
||||
bookingFinshed.MiniSurvey.Title,
|
||||
Is.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Subtitle,
|
||||
bookingFinshed.MiniSurvey.Subtitle,
|
||||
Is.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Footer,
|
||||
bookingFinshed.MiniSurvey.Footer,
|
||||
Is.Null);
|
||||
}
|
||||
|
||||
|
@ -1170,7 +1194,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestCreateMiniSurvey_EmptyQuery()
|
||||
{
|
||||
var response = JsonConvert.DeserializeObject<ResponseContainer<ReservationCancelReturnResponse>>(@"
|
||||
var response = JsonConvert.DeserializeObject<ResponseContainer<DoReturnResponse>>(@"
|
||||
{
|
||||
""shareejson"" : {
|
||||
""user_miniquery"" : {
|
||||
|
@ -1180,22 +1204,22 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
|
||||
");
|
||||
|
||||
var survey = response.shareejson.Create();
|
||||
var bookingFinished = response.shareejson.Create();
|
||||
|
||||
Assert.That(
|
||||
survey,
|
||||
bookingFinished,
|
||||
Is.Not.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Title,
|
||||
bookingFinished.MiniSurvey.Title,
|
||||
Is.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Subtitle,
|
||||
bookingFinished.MiniSurvey.Subtitle,
|
||||
Is.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Footer,
|
||||
bookingFinished.MiniSurvey.Footer,
|
||||
Is.Null);
|
||||
}
|
||||
|
||||
|
@ -1205,7 +1229,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestCreateMiniSurvey_InvalidQuestion_KeyNull()
|
||||
{
|
||||
var response = JsonConvert.DeserializeObject<ResponseContainer<ReservationCancelReturnResponse>>(@"
|
||||
var response = JsonConvert.DeserializeObject<ResponseContainer<DoReturnResponse>>(@"
|
||||
{
|
||||
""shareejson"" : {
|
||||
""user_miniquery"" : {
|
||||
|
@ -1232,14 +1256,14 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
|
||||
");
|
||||
|
||||
var survey = response.shareejson.Create();
|
||||
var bookingFinised = response.shareejson.Create();
|
||||
|
||||
Assert.That(
|
||||
survey,
|
||||
bookingFinised,
|
||||
Is.Not.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Questions.Count,
|
||||
bookingFinised.MiniSurvey.Questions.Count,
|
||||
Is.EqualTo(0));
|
||||
}
|
||||
|
||||
|
@ -1249,7 +1273,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestCreateMiniSurvey_InvalidQuestion_ValueNull()
|
||||
{
|
||||
var response = JsonConvert.DeserializeObject<ResponseContainer<ReservationCancelReturnResponse>>(@"
|
||||
var response = JsonConvert.DeserializeObject<ResponseContainer<DoReturnResponse>>(@"
|
||||
{
|
||||
""shareejson"" : {
|
||||
""user_miniquery"" : {
|
||||
|
@ -1266,14 +1290,14 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
|
||||
");
|
||||
|
||||
var survey = response.shareejson.Create();
|
||||
var bookingFinished = response.shareejson.Create();
|
||||
|
||||
Assert.That(
|
||||
survey,
|
||||
bookingFinished,
|
||||
Is.Not.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Questions.Count,
|
||||
bookingFinished.MiniSurvey.Questions.Count,
|
||||
Is.EqualTo(0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,15 @@ namespace TestShareeLib.Model.MiniSurvey
|
|||
[Test]
|
||||
public void TestCtor()
|
||||
{
|
||||
Assert.That(
|
||||
new MiniSurveyModel().Questions.Count,
|
||||
Is.EqualTo(0),
|
||||
"Question collection must not be null");
|
||||
|
||||
Assert.That(
|
||||
new MiniSurveyModel().Questions,
|
||||
Is.Not.Null);
|
||||
Is.EqualTo(0),
|
||||
"Question collection must not be null");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ namespace TestShareeLib.Model.MiniSurvey
|
|||
public void TestCtro()
|
||||
{
|
||||
Assert.That(
|
||||
new MiniSurveyModel.QuestionModel().PossibleAnswers,
|
||||
Is.Not.Null);
|
||||
new MiniSurveyModel.QuestionModel().PossibleAnswers.Count,
|
||||
Is.EqualTo(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
18
TestShareeLib/Model/TestBookingFinishedModel.cs
Normal file
18
TestShareeLib/Model/TestBookingFinishedModel.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using NUnit.Framework;
|
||||
using TINK.Model;
|
||||
|
||||
namespace TestShareeLib.Model
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestBookingFinishedModel
|
||||
{
|
||||
[Test]
|
||||
public void TestCtor()
|
||||
{
|
||||
Assert.That(
|
||||
new BookingFinishedModel().MiniSurvey,
|
||||
Is.Not.Null,
|
||||
"Avoid object not set to eqception.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,6 +9,8 @@ using TINK.Model.Services.Geolocation;
|
|||
using TINK.Services.BluetoothLock;
|
||||
using TINK.Model.Device;
|
||||
using TINK.Model.User.Account;
|
||||
using Plugin.Permissions.Abstractions;
|
||||
|
||||
using TestShareeLib.Repository;
|
||||
using TestFramework.Repository;
|
||||
|
||||
|
@ -39,8 +41,8 @@ namespace TestTINKLib.Fixtures.UseCases.Logout
|
|||
activeUri: new Uri(CopriServerUriList.TINK_DEVEL)),
|
||||
accountStore,
|
||||
(isConnected, uri, sessionCookie, mail, expiresAfter) => string.IsNullOrEmpty(sessionCookie)
|
||||
? new ConnectorCache(sessionCookie, mail, new TestShareeLib.Repository.CopriCallsMemory001())
|
||||
: new ConnectorCache(sessionCookie, mail, new TestShareeLib.Repository.CopriCallsMemory001(sessionCookie)),
|
||||
? new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001())
|
||||
: new ConnectorCache(sessionCookie, mail, new CopriCallsMemory001(sessionCookie)),
|
||||
Substitute.For<IServicesContainer<IGeolocation>>(),
|
||||
locksService,
|
||||
device,
|
||||
|
@ -53,7 +55,7 @@ namespace TestTINKLib.Fixtures.UseCases.Logout
|
|||
Assert.IsTrue(l_oTinkApp.ActiveUser.IsLoggedIn);
|
||||
// There are 6 bikes available and 2, one reserved and one rented by javaminsiter.
|
||||
Assert.AreEqual(
|
||||
8,
|
||||
10,
|
||||
l_oTinkApp.GetConnector(true).Query.GetBikesAsync().Result.Response.Count,
|
||||
"Sum of bikes is 6 occupied plus 2 occupied.");
|
||||
Assert.AreEqual(2,
|
||||
|
@ -67,7 +69,7 @@ namespace TestTINKLib.Fixtures.UseCases.Logout
|
|||
|
||||
Assert.IsFalse(l_oTinkApp.ActiveUser.IsLoggedIn);
|
||||
Assert.AreEqual(
|
||||
6,
|
||||
8,
|
||||
l_oTinkApp.GetConnector(true).Query.GetBikesAsync().Result.Response.Count,
|
||||
"Sum of bikes is 6 occupied, no one occupied because no user is logged in");
|
||||
Assert.AreEqual(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue