示例#1
0
 public void ContentTest()
 {
     TypedHistoryWrapper target = new TypedHistoryWrapper();
       TypedHistory expected = new TypedHistory { Content = "", Type = "text", LastTyped = System.DateTime.Now };
       TypedHistory actual;
       target.Content = expected;
       actual = target.Content;
       Assert.AreEqual(expected, actual);
 }
示例#2
0
 public void FromOperaLinkXmlTest()
 {
     TypedHistoryWrapper target = new TypedHistoryWrapper();
       string xmlString = "<typed_history status=\"added\" content=\"ashula.info\" type=\"text\"><last_typed>2010-04-14T18:22:42Z</last_typed></typed_history>";
       target.FromOperaLinkXml(xmlString);
       Assert.AreEqual(SyncState.Added, target.State);
       Assert.AreEqual("ashula.info", target.Content.Content);
     <<<<<<< HEAD
       Assert.AreEqual("2010-04-14T18:22:42Z", target.Content.LastTyped.ToW3cDtfInUtc());
     =======
       Assert.AreEqual("2010-04-14T18:22:42Z", target.Content.LastTyped.ToW3CDTFInUtc());
     >>>>>>> adc8b8bbf751bd573a6890289b283baf468bbeb4
 }
示例#3
0
        public void IsSameContentTest()
        {
            TypedHistory hoge = new TypedHistory { Content = "hoge" };
              TypedHistory huga = new TypedHistory { Content = "huga" };
              TypedHistoryWrapper target = new TypedHistoryWrapper { Content = hoge };
              TypedHistoryWrapper other = new TypedHistoryWrapper { Content = huga };
              bool expected = false;
              bool actual;
              actual = target.IsSameContent(other);
              Assert.AreEqual(expected, actual);

              other = new TypedHistoryWrapper { Content = hoge };
              expected = true;
              actual = target.IsSameContent(other);
              Assert.AreEqual(expected, actual);
        }
示例#4
0
 public void ModContentTest()
 {
     var n = System.DateTime.Now;
       TypedHistoryWrapper target = new TypedHistoryWrapper
       {
     Content = new TypedHistory { Content = "hoge" }
       };
       TypedHistoryWrapper other = new TypedHistoryWrapper
       {
     Content = new TypedHistory { Content = "mod", LastTyped = n, }
       };
       target.ModContent(other);
       Assert.AreEqual(SyncState.Modified, target.State); // state is modified
       Assert.AreEqual("hoge", target.Content.Content); // content.content not change
       Assert.AreEqual(n, target.Content.LastTyped); // change datetime
       Assert.AreEqual("selected", target.Content.Type); // type is selected
 }
示例#5
0
 public void TypedHistoryWrapperConstructorTest()
 {
     TypedHistoryWrapper target = new TypedHistoryWrapper();
       Assert.AreEqual(SyncState.Added, target.State);
       Assert.AreEqual("<typed_history />", target.ToOperaLinkXml());
 }
示例#6
0
 public void ToOperaLinkXmlTest()
 {
     var lt = new System.DateTime(2010, 4, 30, 20, 21, 22, System.DateTimeKind.Local);
       TypedHistoryWrapper target = new TypedHistoryWrapper
       {
     Content = new TypedHistory
     {
       Content = "foo bar &<>\"'",
       Type = "text",
       LastTyped = lt
     },
     State = SyncState.Added
       };
       string d = lt.ToW3CDTFInUtc();
       string expected = "<typed_history status=\"added\" content=\"foo bar &amp;&lt;>&quot;'\" type=\"text\"><last_typed>" + d + "</last_typed></typed_history>";
       string actual;
       actual = target.ToOperaLinkXml();
       Assert.AreEqual(expected, actual);
 }
示例#7
0
 public void StateTest()
 {
     TypedHistoryWrapper target = new TypedHistoryWrapper();
       SyncState expected = SyncState.Added;
       SyncState actual;
       target.State = expected;
       actual = target.State;
       Assert.AreEqual(expected, actual);
 }