Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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);
        }