Пример #1
0
 public void ShouldPreserveTitleAndDescriptionWhenTitleIsShorterThanDescription()
 {
     const string testTitle = "TitleShorter";
     const string testDescription = "DescriptionIsLongerThanTitle";
     var testData = new Io.GuessWhat.MainApp.ViewModels.ChecklistViewModel()
     {
         Title = testTitle,
         Description = testDescription,
         Items = string.Empty,
     };
     var result = GuessWhat.MainApp.Models.ChecklistModel.FromViewModel(testData);
     Assert.Equal(result.Title, testData.Title);
     Assert.Equal(result.Description, testData.Description);
 }
Пример #2
0
 public void ShouldCreateAViewModelWithTitleAndDescriptionAndItems()
 {
     const string testTitle = "Hello, World!";
     const string testDescription = "Lorel ipsum";
     const string testItems = "Item1\r\nItem2";
     var testData = new Io.GuessWhat.MainApp.ViewModels.ChecklistViewModel()
     {
         Title = testTitle,
         Description = testDescription,
         Items = testItems,
     };
     var result = GuessWhat.MainApp.Models.ChecklistModel.FromViewModel(testData);
     Assert.Equal(result.Title, testData.Title);
     Assert.Equal(result.Description, testData.Description);
     Assert.Equal(result.Items.Count, 2);
     Assert.Equal(result.Items[0].Title, "Item1");
     Assert.Equal(result.Items[1].Title, "Item2");
 }
Пример #3
0
 public void ShouldLimitTitleAndDescriptionToMaxSize()
 {
     string testTitle = new string('A', GuessWhat.MainApp.Models.ChecklistModel.TitleMaxLength + 20);
     string testDescription = new string('A', GuessWhat.MainApp.Models.ChecklistModel.DescriptionMaxLength + 20);
     var testData = new Io.GuessWhat.MainApp.ViewModels.ChecklistViewModel()
     {
         Title = testTitle,
         Description = testDescription,
         Items = string.Empty,
     };
     var result = GuessWhat.MainApp.Models.ChecklistModel.FromViewModel(testData);
     Assert.True(result.Title.Length < testData.Title.Length);
     Assert.True(result.Description.Length < testData.Description.Length);
     Assert.Equal(result.Title.Length, GuessWhat.MainApp.Models.ChecklistModel.TitleMaxLength);
     Assert.Equal(result.Description.Length, GuessWhat.MainApp.Models.ChecklistModel.DescriptionMaxLength);
     Assert.Equal(result.Title, testData.Title.Substring(0, GuessWhat.MainApp.Models.ChecklistModel.TitleMaxLength));
     Assert.Equal(result.Description, testData.Description.Substring(0, GuessWhat.MainApp.Models.ChecklistModel.DescriptionMaxLength));
 }