public bool Add(int id, UserWord word)
 {
     if (!id.Validate() && !word.Validate())
     {
         throw new Exception("Invalid model");
     }
     return(rep.Add(id, word));
 }
Exemple #2
0
        public void ExtensionsTest_Validate_UserWord()
        {
            var good = new UserWord
            {
                Id     = 0,
                WordId = 1,
                UserId = 1
            };
            var bad = new UserWord
            {
                Id     = -1,
                WordId = -1,
                UserId = 1
            };

            Assert.AreEqual(true, good.Validate());
            Assert.AreEqual(false, bad.Validate());
        }