コード例 #1
0
        // [Test]
        public void CreateTestEntries()
        {
            Entry    entry;
            DateTime dateTime = new DateTime(2004, 01, 1);

            dateTime = dateTime.AddDays(12.33);
            entry    = new Entry();
            entry.Initialize();
            entry.Title       = "Naivete of the Mathematician ";
            entry.Content     = "Mathematics is not yet capable of coping with the naivete of the mathematician himself.  (Sociology Learns the Language of Mathematics.)";
            entry.EntryId     = Guid.NewGuid().ToString();
            entry.Author      = "Abraham Kaplan";
            entry.CreatedUtc  = dateTime;
            entry.ModifiedUtc = dateTime;
            entry.Categories  = "A Random Mathematical Quotation";
            BlogDataService.SaveEntry(entry);
        }
コード例 #2
0
        public void VerifySaveEntry()
        {
            Guid  entryId = Guid.NewGuid();
            Entry entry   = new Entry();

            entry.Initialize();
            entry.CreatedUtc  = new DateTime(2004, 1, 1);
            entry.Title       = "Happy New ear";
            entry.Content     = "The beginning of a new year.";
            entry.Categories  = "Test";
            entry.EntryId     = entryId.ToString();
            entry.Description = "The description of the entry.";
            entry.Author      = "Inigo Montoya";
            // TODO:  Update so private entries will work as well.
            entry.IsPublic        = true;
            entry.Language        = "C#";
            entry.Link            = "http://mark.michaelis.net/blog";
            entry.ModifiedUtc     = entry.CreatedUtc;
            entry.ShowOnFrontPage = false;
            BlogDataService.SaveEntry(entry);

            entry = BlogDataService.GetEntry(entryId.ToString());
            Assert.IsNotNull(entry, "Unable to retrieve the specified entry.");
            Assert.AreEqual(entryId.ToString(), entry.EntryId);
            Assert.AreEqual(new DateTime(2004, 1, 1), entry.CreatedUtc);
            Assert.AreEqual("Happy New ear", entry.Title);
            Assert.AreEqual("The beginning of a new year.", entry.Content);
            Assert.AreEqual("Test", entry.Categories);
            Assert.AreEqual("The description of the entry.", entry.Description);
            Assert.AreEqual("Inigo Montoya", entry.Author);
            Assert.AreEqual(true, entry.IsPublic);
            Assert.AreEqual("C#", entry.Language);
            Assert.AreEqual("http://mark.michaelis.net/blog", entry.Link);
            Assert.AreEqual(entry.CreatedUtc, entry.ModifiedUtc);
            Assert.AreEqual(false, entry.ShowOnFrontPage);
        }