Example #1
0
        public void PlaylistLinkIsInvalid()
        {
            // Create a new playlist link with bad data.
            var playlistLink = new PlaylistLink
            {
                Id = int.MaxValue
            };

            // Get the number of errors in the model. Expecting 1 error.
            var errorcount = ValidateModel(playlistLink).Count;

            // There should be an error. If there's not, something is wrong with validation.
            Assert.NotEqual(0, errorcount);
        }
Example #2
0
        public void PlaylistLinkIsValid()
        {
            // Create a new playlist link with good data.
            var playlistLink = new PlaylistLink
            {
                Id     = int.MaxValue,
                UserId = int.MaxValue
            };

            // Get the number of errors in the model. Expecting 0 errors.
            var errorcount = ValidateModel(playlistLink).Count;

            // No errors indicates that the model built without errors, and we like that.
            Assert.Equal(0, errorcount);
        }