Ejemplo n.º 1
0
        public void UpdateKeywordIsPersisted()
        {
            using (var businessContext = new BusinessContext())
            {
                var language = new Language
                {
                    Name = "LanguageName"
                };

                businessContext.AddNewLanguage(language);

                var keyword = new Keyword
                {
                    Name = "KeywordName",
                    LanguageId = 1,
                };

                businessContext.AddNewKeyword(keyword);

                keyword.Name = "New KeywordName";

                businessContext.UpdateKeyword(keyword);

                bool updated = businessContext.DataContext.Keywords.Any(k => k.Id == keyword.Id && k.Name == keyword.Name);

                Assert.IsTrue(updated);
            }
        }
Ejemplo n.º 2
0
        public void UpdateKeyword_ThrowsException_WhenKeywordIdDoesNotExist()
        {
            using (var businessContext = new BusinessContext())
            {
                var keyword = new Keyword
                {
                    Name = "KeywordName"
                };

                businessContext.UpdateKeyword(keyword);
            }
        }