Ejemplo n.º 1
0
        public void FavoriteListLinkIsInvalid()
        {
            // Create a new favorite list link with bad data.
            var favoriteListLink = new FavoriteListLink
            {
                Id = int.MaxValue
            };

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

            // There should be an error. If there's not, something is wrong with validation.
            Assert.NotEqual(0, errorcount);
        }
Ejemplo n.º 2
0
        public void FavoriteListLinkIsValid()
        {
            // Create a new favorite list link with good data.
            var favoriteListLink = new FavoriteListLink
            {
                Id     = int.MaxValue,
                UserId = int.MaxValue
            };

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

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