コード例 #1
0
        public void CanAddFavourite()
        {
            // Setup
            var researcher = new Researcher();
            researcher.AuthorDocument("New document", "...");
            researcher.Save();

            // Act
            researcher.AddFavourite(researcher.Documents.First().Id);
            researcher.AddFavourite(researcher.Documents.First().Id);

            // Assert
            researcher = Researcher.Find(researcher.Id);
            Assert.AreEqual(1, researcher.Favourites.Count);
        }
コード例 #2
0
        public void CanRemoveFavourite()
        {
            // Setup
            var researcher = new Researcher();
            researcher.AuthorDocument("Title", "...");
            researcher.Save();
            researcher.AddFavourite(researcher.Documents.First().Id);

            // Act
            Researcher.Find(researcher.Id).RemoveFavourite(1);

            // Assert
            Assert.AreEqual(0, Researcher.Find(researcher.Id).Favourites.Count);
            Assert.AreEqual(0, Favourite.FindAll().Count());
        }