mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2024-12-23 23:56:26 +01:00
60 lines
1.9 KiB
C#
60 lines
1.9 KiB
C#
|
using NUnit.Framework;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Text;
|
|||
|
using TINK.ViewModel.MiniSurvey.Question;
|
|||
|
|
|||
|
namespace TestShareeLib.ViewModel.MiniSurvey.Question
|
|||
|
{
|
|||
|
[TestFixture]
|
|||
|
public class TestCheckOneViewModel
|
|||
|
{
|
|||
|
[Test]
|
|||
|
public void TestCtor()
|
|||
|
{
|
|||
|
var vm = new CheckOneViewModel(
|
|||
|
new KeyValuePair<string, string>("q5", "wie ist das Wetter heute"),
|
|||
|
new Dictionary<string, string> { { "opt1", "regnerisch"}, { "opt2", "bewölkt" }, { "opt3", "sonnig" } });
|
|||
|
|
|||
|
Assert.That(
|
|||
|
vm.Question.Key,
|
|||
|
Is.EqualTo("q5"),
|
|||
|
"Key is essential for COPRI request.");
|
|||
|
|
|||
|
Assert.That(
|
|||
|
vm.QuestionText,
|
|||
|
Is.EqualTo("wie ist das Wetter heute"),
|
|||
|
"Question shown to user.");
|
|||
|
|
|||
|
Assert.That(
|
|||
|
string.Join(',', vm.AnswersText),
|
|||
|
Is.EqualTo("regnerisch,bewölkt,sonnig"),
|
|||
|
"Gui must show three options.");
|
|||
|
|
|||
|
Assert.That(
|
|||
|
vm.AnswerText,
|
|||
|
Is.EqualTo(null),
|
|||
|
"GUI should not show selected entry.");
|
|||
|
|
|||
|
Assert.That(
|
|||
|
vm.Answer.Key,
|
|||
|
Is.EqualTo(null),
|
|||
|
"View model shold not hold any selected endtry.");
|
|||
|
}
|
|||
|
|
|||
|
[Test]
|
|||
|
public void TestSelected()
|
|||
|
{
|
|||
|
var vm = new CheckOneViewModel(
|
|||
|
new KeyValuePair<string, string>("q5", "wie ist das Wetter heute"),
|
|||
|
new Dictionary<string, string> { { "opt1", "regnerisch" }, { "opt2", "bewölkt" }, { "opt3", "sonnig" } });
|
|||
|
|
|||
|
vm.AnswerText = "sonnig"; // Member is called if user selects an entry.
|
|||
|
Assert.That(
|
|||
|
vm.Answer.Key,
|
|||
|
Is.EqualTo("opt3"),
|
|||
|
"Key matching to selected item must be set as answer.");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|