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); }
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 }
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); }
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 }
public void TypedHistoryWrapperConstructorTest() { TypedHistoryWrapper target = new TypedHistoryWrapper(); Assert.AreEqual(SyncState.Added, target.State); Assert.AreEqual("<typed_history />", target.ToOperaLinkXml()); }
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 &<>"'\" type=\"text\"><last_typed>" + d + "</last_typed></typed_history>"; string actual; actual = target.ToOperaLinkXml(); Assert.AreEqual(expected, actual); }
public void StateTest() { TypedHistoryWrapper target = new TypedHistoryWrapper(); SyncState expected = SyncState.Added; SyncState actual; target.State = expected; actual = target.State; Assert.AreEqual(expected, actual); }