void CustomLabel_ColorChangedThenCanceled_TextSegmentsHaveCorrectColor() { var model = new CustomLabel { FormatString = "text format {song}", Color = Colors.Blue }; var vm = new CustomLabelViewModel(model, _dialogMock.Object, _sessionMock.Object, _messageBusMock.Object); vm.Color = Colors.Black; vm.CancelEdit(); Assert.All(vm.TextSegments, segment => Assert.Equal(Colors.Blue, segment.Color)); }
void CustomLabel_CancelEdit_ModelHasNoChanges() { var formatString = "test"; var model = new CustomLabel { FormatString = formatString }; var vm = new CustomLabelViewModel(model, _dialogMock.Object, _sessionMock.Object, _messageBusMock.Object); vm.FormatString = "new"; vm.CancelEdit(); Assert.Equal(formatString, vm.FormatString); Assert.Equal(formatString, model.FormatString); }
void CustomLabel_TextFormatStringChangedThenCanceled_CorrectTextSegments() { var songname = "song"; var model = new CustomLabel { FormatString = "text format {song}" }; _sessionMock.SetupGet(m => m.SongName).Returns(songname); var vm = new CustomLabelViewModel(model, _dialogMock.Object, _sessionMock.Object, _messageBusMock.Object); Assert.Equal(2, vm.TextSegments.Count()); vm.FormatString = "new format string"; vm.CancelEdit(); Assert.Equal(2, vm.TextSegments.Count()); Assert.Equal(songname, vm.TextSegments.ToList()[1].Text); }