public void Remove_Should_Use_Database()
        {
            Stories.Add(CreateStory() as Story);

            database.Setup(d => d.Delete(It.IsAny <Story>())).Verifiable();

            _storyRepository.Remove(Stories[0]);
        }
示例#2
0
        public void Remove_And_Presist_Changes_Should_Succeed()
        {
            using (BeginTransaction())
            {
                var user     = (User)_domainFactory.CreateUser("dummyuser", "*****@*****.**", String.Empty);
                var category = _domainFactory.CreateCategory("dummycategory");
                var story    = _domainFactory.CreateStory(category, user, "192.168.0.1", "Remove And Presist Changes Should Succeed", "Remove_And_Presist_Changes_Should_Succeed", "http://kiGG.net/Remove_And_Presist_Changes_Should_Succeed.aspx");
                var tag      = _domainFactory.CreateTag("DummyTag");
                story.AddTag(tag);
                user.AddTag(tag);

                #pragma warning disable 168
                var comment  = _domainFactory.CreateComment(story, "comment", SystemTime.Now(), user, "192.168.0.2");
                var vote     = _domainFactory.CreateStoryVote(story, SystemTime.Now(), user, "192.168.0.1");
                var spamMark = _domainFactory.CreateMarkAsSpam(story, SystemTime.Now(), user, "192.168.0.3");
                #pragma warning restore 168

                _storyRepository.Add(story);
                _database.SubmitChanges();

                _storyRepository.Remove(story);
                _database.SubmitChanges();
            }
        }
        // DELETE: api/Stories/5
        public void Delete(string id)
        {
            var storyId = ObjectId.Parse(id);

            _storyRepository.Remove(storyId);
        }