public void AddArtistCommand_ValidExecute() { var model = new AddEditComicBookViewModel(null, null, null, null); model.CheckPassedComicBookAsync(null); model.SelectedArtist = TestData.GetArtistSample().First(); model.AddArtistCommand.Execute(); Assert.NotEmpty(model.InputModel.ComicBookArtists); }
public void PriceErrorMessage_DisplaysProperly() { var model = new AddEditComicBookViewModel(null, null, null, null); model.CheckPassedComicBookAsync(null); model.SetErrorMessagesChangesAsync(); model.InputModel.Price = -1; Assert.True(model.InputModel.HasErrors); Assert.False(model.CanSave); Assert.Equal("Please enter valid price.", model.PriceErrorMessage); }
public void TitleErrorMessage_DisplaysProperly() { var model = new AddEditComicBookViewModel(null, null, null, null); model.CheckPassedComicBookAsync(null); model.SetErrorMessagesChangesAsync(); model.InputModel.Title = " "; Assert.True(model.InputModel.HasErrors); Assert.False(model.CanSave); Assert.Equal(model.InputModel.GetFirstError("Title"), model.TitleErrorMessage); }
public void AddArtistCommand_AlreadyInCollection() { var model = new AddEditComicBookViewModel(null, null, null, null); model.CheckPassedComicBookAsync(null); model.SelectedArtist = TestData.GetArtistSample().First(); model.AddArtistCommand.Execute(); model.SelectedArtist = TestData.GetArtistSample().First(); model.AddArtistCommand.Execute(); Assert.NotEmpty(model.InputModel.ComicBookArtists); Assert.Single(model.InputModel.ComicBookArtists); Assert.Equal(model.SelectedArtist.Name, model.InputModel.ComicBookArtists[0].Artist.Name); }