mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-21 21:46:27 +02:00
Mini survey added.
Minor fiexes.
This commit is contained in:
parent
ddfea49ea6
commit
e321764119
73 changed files with 1628 additions and 185 deletions
|
@ -14,6 +14,7 @@ using static TINK.Repository.CopriCallsMemory;
|
|||
using BikeInfo = TINK.Model.Bike.BluetoothLock.BikeInfo;
|
||||
using TINK.Model.User.Account;
|
||||
using Xamarin.Forms;
|
||||
using TINK.Model.MiniSurvey;
|
||||
|
||||
namespace TestTINKLib.Fixtures.Connector
|
||||
{
|
||||
|
@ -844,7 +845,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestCreateTariffDescription()
|
||||
{
|
||||
var tariffDescription = TINK.Repository.Response.JsonConvertRethrow.DeserializeObject<TINK.Repository.Response.TariffDescription>(
|
||||
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
||||
@"{
|
||||
""eur_per_hour"" : ""10.50"",
|
||||
""abo_eur_per_month"" : ""920.99"",
|
||||
|
@ -877,7 +878,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestCreateTariffDescription_Name()
|
||||
{
|
||||
var tariffDescription = TINK.Repository.Response.JsonConvertRethrow.DeserializeObject<TINK.Repository.Response.TariffDescription>(
|
||||
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
||||
@"{
|
||||
""eur_per_hour"" : ""10.50"",
|
||||
""abo_eur_per_month"" : ""920.99"",
|
||||
|
@ -894,7 +895,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestCreateTariffDescription_Number()
|
||||
{
|
||||
var tariffDescription = TINK.Repository.Response.JsonConvertRethrow.DeserializeObject<TINK.Repository.Response.TariffDescription>(
|
||||
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
||||
@"{
|
||||
""eur_per_hour"" : ""10.50"",
|
||||
""abo_eur_per_month"" : ""920.99"",
|
||||
|
@ -911,7 +912,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestCreateTariffDescription_FreeTimePerSession()
|
||||
{
|
||||
var tariffDescription = TINK.Repository.Response.JsonConvertRethrow.DeserializeObject<TINK.Repository.Response.TariffDescription>(
|
||||
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
||||
@"{
|
||||
""eur_per_hour"" : ""10.50"",
|
||||
""abo_eur_per_month"" : ""920.99"",
|
||||
|
@ -928,7 +929,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestCreateTariffDescription_FeeEuroPerHour()
|
||||
{
|
||||
var tariffDescription = TINK.Repository.Response.JsonConvertRethrow.DeserializeObject<TINK.Repository.Response.TariffDescription>(
|
||||
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
||||
@"{
|
||||
""eur_per_hour"" : ""10.50"",
|
||||
""abo_eur_per_month"" : ""920.99"",
|
||||
|
@ -945,7 +946,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestCreateTariffDescription_AboEuroPerMonth()
|
||||
{
|
||||
var tariffDescription = TINK.Repository.Response.JsonConvertRethrow.DeserializeObject<TINK.Repository.Response.TariffDescription>(
|
||||
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
||||
@"{
|
||||
""eur_per_hour"" : ""10.50"",
|
||||
""abo_eur_per_month"" : ""920.99"",
|
||||
|
@ -962,7 +963,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestCreateTariffDescription_Name_Empty()
|
||||
{
|
||||
var tariffDescription = TINK.Repository.Response.JsonConvertRethrow.DeserializeObject<TINK.Repository.Response.TariffDescription>(
|
||||
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
||||
@"{}");
|
||||
|
||||
Assert.That(
|
||||
|
@ -973,7 +974,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestCreateTariffDescription_Number_Empty()
|
||||
{
|
||||
var tariffDescription = TINK.Repository.Response.JsonConvertRethrow.DeserializeObject<TINK.Repository.Response.TariffDescription>(
|
||||
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
||||
@"{}");
|
||||
|
||||
Assert.That(
|
||||
|
@ -984,7 +985,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestCreateTariffDescription_FreeTimePerSession_Empty()
|
||||
{
|
||||
var tariffDescription = TINK.Repository.Response.JsonConvertRethrow.DeserializeObject<TINK.Repository.Response.TariffDescription>(
|
||||
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
||||
@"{}");
|
||||
|
||||
Assert.That(
|
||||
|
@ -995,7 +996,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestCreateTariffDescription_FeeEuroPerHour_Empty()
|
||||
{
|
||||
var tariffDescription = TINK.Repository.Response.JsonConvertRethrow.DeserializeObject<TINK.Repository.Response.TariffDescription>(
|
||||
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
||||
@"{}");
|
||||
|
||||
Assert.That(
|
||||
|
@ -1006,7 +1007,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
[Test]
|
||||
public void TestCreateTariffDescription_AboEuroPerMonth_Empty()
|
||||
{
|
||||
var tariffDescription = TINK.Repository.Response.JsonConvertRethrow.DeserializeObject<TINK.Repository.Response.TariffDescription>(
|
||||
var tariffDescription = JsonConvertRethrow.DeserializeObject<TariffDescription>(
|
||||
@"{}");
|
||||
|
||||
Assert.That(
|
||||
|
@ -1018,7 +1019,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
public void TestCreateTariffDescription_Name_Null()
|
||||
{
|
||||
Assert.That(
|
||||
BikeInfoFactory.Create((TINK.Repository.Response.TariffDescription)null).Name,
|
||||
BikeInfoFactory.Create((TariffDescription)null).Name,
|
||||
Is.Null);
|
||||
}
|
||||
|
||||
|
@ -1026,7 +1027,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
public void TestCreateTariffDescription_Number_Null()
|
||||
{
|
||||
Assert.That(
|
||||
BikeInfoFactory.Create((TINK.Repository.Response.TariffDescription)null).Number,
|
||||
BikeInfoFactory.Create((TariffDescription)null).Number,
|
||||
Is.Null);
|
||||
}
|
||||
|
||||
|
@ -1034,7 +1035,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
public void TestCreateTariffDescription_FreeTimePerSession_Null()
|
||||
{
|
||||
Assert.That(
|
||||
BikeInfoFactory.Create((TINK.Repository.Response.TariffDescription)null).FreeTimePerSession,
|
||||
BikeInfoFactory.Create((TariffDescription)null).FreeTimePerSession,
|
||||
Is.EqualTo(TimeSpan.Zero));
|
||||
}
|
||||
|
||||
|
@ -1042,7 +1043,7 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
public void TestCreateTariffDescription_FeeEuroPerHour_Null()
|
||||
{
|
||||
Assert.That(
|
||||
BikeInfoFactory.Create((TINK.Repository.Response.TariffDescription)null).FeeEuroPerHour,
|
||||
BikeInfoFactory.Create((TariffDescription)null).FeeEuroPerHour,
|
||||
Is.NaN);
|
||||
}
|
||||
|
||||
|
@ -1050,8 +1051,230 @@ namespace TestTINKLib.Fixtures.Connector
|
|||
public void TestCreateTariffDescription_AboEuroPerMonth_Null()
|
||||
{
|
||||
Assert.That(
|
||||
BikeInfoFactory.Create((TINK.Repository.Response.TariffDescription)null).AboEuroPerMonth,
|
||||
BikeInfoFactory.Create((TariffDescription)null).AboEuroPerMonth,
|
||||
Is.NaN);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COPRI response shortened, part not belonging to user_miniquery discarded.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestCreateMiniSurvey()
|
||||
{
|
||||
var response = JsonConvert.DeserializeObject<ResponseContainer<ReservationCancelReturnResponse>>(@"
|
||||
{
|
||||
""shareejson"" : {
|
||||
""user_miniquery"" : {
|
||||
""title"" : ""Bitte unterstützen Sie unsere Begleitforschung"",
|
||||
""footer"" : ""Herzlichen Dank und viel Spaß bei der nächsten Fahrt!"",
|
||||
""questions"" : {
|
||||
""q3"" : {
|
||||
""quest_text"" : ""3. Haben Sie Anmerkungen oder Anregungen?"",
|
||||
""type"" : ""text"",
|
||||
""query"" : {
|
||||
""opt1"" : """"
|
||||
}
|
||||
},
|
||||
""q1"" : {
|
||||
""type"" : ""check_one"",
|
||||
""quest_text"" : ""1. Was war der Hauptzweck dieser Ausleihe?"",
|
||||
""query"" : {
|
||||
""opt2"" : ""b. Kinderbeförderung"",
|
||||
""opt5"" : ""e. Ausprobieren"",
|
||||
""opt4"" : ""d. Freizeit"",
|
||||
""opt1"" : ""a. Einkauf"",
|
||||
""opt3"" : ""c. Lastentransport"",
|
||||
""opt6"" : ""f. Sonstiges""
|
||||
}
|
||||
},
|
||||
""q2"" : {
|
||||
""type"" : ""check_one"",
|
||||
""quest_text"" : ""2. Welches Verkehrsmittel hätten Sie ansonsten benutzt?"",
|
||||
""query"" : {
|
||||
""opt6"" : ""f. Keines (ich hätte die Fahrt sonst nicht gemacht)"",
|
||||
""opt3"" : ""c. Bus oder Bahn"",
|
||||
""opt1"" : ""a. Auto"",
|
||||
""opt2"" : ""b. Motorrad oder Motorroller"",
|
||||
""opt7"" : ""g. Sonstige"",
|
||||
""opt4"" : ""d. Eigenes Fahrrad"",
|
||||
""opt5"" : ""e. Zu Fuß""
|
||||
}
|
||||
}
|
||||
},
|
||||
""subtitle"" : ""Ihre drei Antworten werden anonym gespeichert.""
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
");
|
||||
|
||||
var survey = response.shareejson.Create();
|
||||
|
||||
Assert.That(
|
||||
survey,
|
||||
Is.Not.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Title,
|
||||
Is.EqualTo("Bitte unterstützen Sie unsere Begleitforschung"));
|
||||
|
||||
Assert.That(
|
||||
survey.Subtitle,
|
||||
Is.EqualTo("Ihre drei Antworten werden anonym gespeichert."));
|
||||
|
||||
Assert.That(
|
||||
survey.Footer,
|
||||
Is.EqualTo("Herzlichen Dank und viel Spaß bei der nächsten Fahrt!"));
|
||||
|
||||
Assert.That(
|
||||
survey.Questions.Count,
|
||||
Is.EqualTo(3));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COPRI response shortened, part not belonging to user_miniquery discarded.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestCreateMiniSurvey_Null()
|
||||
{
|
||||
var response = JsonConvert.DeserializeObject<ResponseContainer<ReservationCancelReturnResponse>>(@"
|
||||
{
|
||||
""shareejson"" : {
|
||||
}
|
||||
}
|
||||
|
||||
");
|
||||
|
||||
var survey = response.shareejson.Create();
|
||||
|
||||
Assert.That(
|
||||
survey,
|
||||
Is.Not.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Title,
|
||||
Is.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Subtitle,
|
||||
Is.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Footer,
|
||||
Is.Null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COPRI response shortened, part not belonging to user_miniquery discarded.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestCreateMiniSurvey_EmptyQuery()
|
||||
{
|
||||
var response = JsonConvert.DeserializeObject<ResponseContainer<ReservationCancelReturnResponse>>(@"
|
||||
{
|
||||
""shareejson"" : {
|
||||
""user_miniquery"" : {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
");
|
||||
|
||||
var survey = response.shareejson.Create();
|
||||
|
||||
Assert.That(
|
||||
survey,
|
||||
Is.Not.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Title,
|
||||
Is.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Subtitle,
|
||||
Is.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Footer,
|
||||
Is.Null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COPRI response shortened, part not belonging to user_miniquery discarded.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestCreateMiniSurvey_InvalidQuestion_KeyNull()
|
||||
{
|
||||
var response = JsonConvert.DeserializeObject<ResponseContainer<ReservationCancelReturnResponse>>(@"
|
||||
{
|
||||
""shareejson"" : {
|
||||
""user_miniquery"" : {
|
||||
""title"" : ""Bitte unterstützen Sie unsere Begleitforschung"",
|
||||
""footer"" : ""Herzlichen Dank und viel Spaß bei der nächsten Fahrt!"",
|
||||
""questions"" : {
|
||||
"""" : {
|
||||
""type"" : ""check_one"",
|
||||
""quest_text"" : ""1. Was war der Hauptzweck dieser Ausleihe?"",
|
||||
""query"" : {
|
||||
""opt2"" : ""b. Kinderbeförderung"",
|
||||
""opt5"" : ""e. Ausprobieren"",
|
||||
""opt4"" : ""d. Freizeit"",
|
||||
""opt1"" : ""a. Einkauf"",
|
||||
""opt3"" : ""c. Lastentransport"",
|
||||
""opt6"" : ""f. Sonstiges""
|
||||
}
|
||||
},
|
||||
},
|
||||
""subtitle"" : ""Ihre drei Antworten werden anonym gespeichert.""
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
");
|
||||
|
||||
var survey = response.shareejson.Create();
|
||||
|
||||
Assert.That(
|
||||
survey,
|
||||
Is.Not.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Questions.Count,
|
||||
Is.EqualTo(0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// COPRI response shortened, part not belonging to user_miniquery discarded.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestCreateMiniSurvey_InvalidQuestion_ValueNull()
|
||||
{
|
||||
var response = JsonConvert.DeserializeObject<ResponseContainer<ReservationCancelReturnResponse>>(@"
|
||||
{
|
||||
""shareejson"" : {
|
||||
""user_miniquery"" : {
|
||||
""title"" : ""Bitte unterstützen Sie unsere Begleitforschung"",
|
||||
""footer"" : ""Herzlichen Dank und viel Spaß bei der nächsten Fahrt!"",
|
||||
""questions"" : {
|
||||
""q1"" : {
|
||||
},
|
||||
},
|
||||
""subtitle"" : ""Ihre drei Antworten werden anonym gespeichert.""
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
");
|
||||
|
||||
var survey = response.shareejson.Create();
|
||||
|
||||
Assert.That(
|
||||
survey,
|
||||
Is.Not.Null);
|
||||
|
||||
Assert.That(
|
||||
survey.Questions.Count,
|
||||
Is.EqualTo(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
20
TestShareeLib/Model/MiniSurvey/TestMiniSurveyModel.cs
Normal file
20
TestShareeLib/Model/MiniSurvey/TestMiniSurveyModel.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using TINK.Model.MiniSurvey;
|
||||
|
||||
namespace TestShareeLib.Model.MiniSurvey
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestMiniSurveyModel
|
||||
{
|
||||
[Test]
|
||||
public void TestCtor()
|
||||
{
|
||||
Assert.That(
|
||||
new MiniSurveyModel().Questions,
|
||||
Is.Not.Null);
|
||||
}
|
||||
}
|
||||
}
|
16
TestShareeLib/Model/MiniSurvey/TestQuestionModel.cs
Normal file
16
TestShareeLib/Model/MiniSurvey/TestQuestionModel.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using NUnit.Framework;
|
||||
using TINK.Model.MiniSurvey;
|
||||
|
||||
namespace TestShareeLib.Model.MiniSurvey
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestQuestionModel
|
||||
{
|
||||
public void TestCtro()
|
||||
{
|
||||
Assert.That(
|
||||
new MiniSurveyModel.QuestionModel().PossibleAnswers,
|
||||
Is.Not.Null);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue