Ejemplo n.º 1
0
        public void CanSave_WithoutLastName_ReturnsFalse()
        {
            var model = new AddEditArtistViewModel(null, null);

            model.SetErrorMessageChangesAsync();
            model.InputModel.FirstName = "Scott";

            Assert.False(model.CanSave);
        }
Ejemplo n.º 2
0
        public void CanSave_ProperArtist_ReturnsTrue()
        {
            var model = new AddEditArtistViewModel(null, null);

            model.SetErrorMessageChangesAsync();
            model.InputModel.FirstName = "Scott";
            model.InputModel.LastName  = "Snyder";

            Assert.True(model.CanSave);
        }
Ejemplo n.º 3
0
        public void FirstNameErrorMessage_SetsProperly()
        {
            var model = new AddEditArtistViewModel(null, null);

            model.SetErrorMessageChangesAsync();
            model.InputModel.FirstName = "";

            var expectedMessage = "First name cannot be empty.";
            var actualMessage   = model.FirstNameErrorMessage;

            Assert.NotEmpty(model.FirstNameErrorMessage);
            Assert.Equal(expectedMessage, actualMessage);
        }
Ejemplo n.º 4
0
        public void CanSave_InputValuesEqualsEditedArtist_ReturnsFalse()
        {
            var model  = new AddEditArtistViewModel(null, null);
            var artist = TestData.GetArtistSample().ToList()[1];

            model.SetErrorMessageChangesAsync();
            model.CheckPassedArtistAsync(artist);

            model.InputModel.FirstName   = artist.FirstName;
            model.InputModel.LastName    = artist.LastName;
            model.InputModel.Description = artist.Description;

            Assert.False(model.CanSave);
        }