Пример #1
0
        public void ParseShouldExtractAllClippings()
        {
            const string sampleClippings =
                @"The Design of Everyday Things: Revised and Expanded Edition (Norman, Don)
- Your Highlight on page 145 | Location 3015-3016 | Added on Thursday, August 15, 2019 10:14:40 AM

Forcing functions can be a nuisance in normal usage. The result is that many people will deliberately disable the forcing function, thereby negating its safety feature.
==========
 The Design of Everyday Things: Revised and Expanded Edition (Norman, Don)
- Your Note on Location 3026-3027 | Added on Thursday, August 15, 2019 10:16:42 AM

Affordances refer to the potential actions that are possible, but these are easily discoverable only if they are perceivable: perceived affordances. It is the signifier component of the perceived affordance that allows people to determine the possible actions.
==========";

            this.WriteText(sampleClippings);

            var clippings = ClippingParser.Parse(this.stream).ToList();

            Assert.AreEqual(2, clippings.Count);
            Assert.AreEqual("The Design of Everyday Things: Revised and Expanded Edition", clippings[0].Book);
            Assert.AreEqual("Norman, Don", clippings[0].Author);
            Assert.AreEqual(ClippingType.Highlight, clippings[0].Type);
            Assert.AreEqual(145, clippings[0].PageNumber);
            Assert.AreEqual(3015, clippings[0].Location.Start);
            Assert.AreEqual(3016, clippings[0].Location.End);
            Assert.AreEqual(new DateTime(2019, 08, 15, 10, 14, 40), clippings[0].CreationDate);
            Assert.IsTrue(clippings[0].Content.StartsWith("Forcing functions can be"));

            Assert.AreEqual(ClippingType.Note, clippings[1].Type);
        }
Пример #2
0
        public void ParseShouldExtractClippingsWithLocationWithoutPage()
        {
            const string sampleClippings =
                @"The Design of Everyday Things: Revised and Expanded Edition (Norman, Don)
- Your Highlight on Location 3026 | Added on Thursday, August 15, 2019 10:16:42 AM

Affordances refer to the potential actions that are possible, but these are easily discoverable only if they are perceivable: perceived affordances.
==========
Design of Everyday Things: Revised and Expanded Edition (Norman, Don)
- Your Highlight on Location 3026-3027 | Added on Thursday, August 15, 2019 10:16:42 AM

Affordances refer to the potential actions that are possible, but these are easily discoverable only if they are perceivable: perceived affordances. It is the signifier component of the perceived affordance that allows people to determine the possible actions.
==========";

            this.WriteText(sampleClippings);

            var clippings = ClippingParser.Parse(this.stream).ToList();

            Assert.AreEqual(2, clippings.Count);
            Assert.AreEqual(-1, clippings[0].PageNumber);
            Assert.AreEqual(3026, clippings[0].Location.Start);
            Assert.AreEqual(3026, clippings[0].Location.End);

            Assert.AreEqual(-1, clippings[1].PageNumber);
            Assert.AreEqual(3026, clippings[1].Location.Start);
            Assert.AreEqual(3027, clippings[1].Location.End);
        }
Пример #3
0
        public void ParseShouldThrowIfStreamIsClosed()
        {
            this.stream.Close();

            Assert.ThrowsException <ArgumentException>(() => ClippingParser.Parse(this.stream).ToList());
        }