DeleteEnclosure() public method

public DeleteEnclosure ( int enclosureId ) : bool
enclosureId int
return bool
コード例 #1
0
        public void CanDeleteEnclosure()
        {
            Blog blog = UnitTestHelper.CreateBlogAndSetupContext();
            var repository = new DatabaseObjectProvider();
            Entry e = UnitTestHelper.CreateEntryInstanceForSyndication("Simone Chiaretta", "Post for testing Enclosures",
                                                                       "Listen to my great podcast");
            int entryId = UnitTestHelper.Create(e);

            Enclosure enc = UnitTestHelper.BuildEnclosure("Nothing to see here.", "httP://blablabla.com", "audio/mp3",
                                                          entryId, 12345678, true, true);
            repository.Create(enc);

            Entry newEntry = repository.GetEntry(entryId, true, false);

            Assert.IsNotNull(newEntry.Enclosure, "Did not create enclosure.");

            repository.DeleteEnclosure(enc.Id);

            Entry newEntry1 = repository.GetEntry(entryId, true, false);

            Assert.IsNull(newEntry1.Enclosure, "Did not delete enclosure.");
        }