public void Add_Item() { var s = new SharedSource <MySharedItem>(); var item1 = new MySharedItem { Id = 1, Name = "A" }; item1.CActivate = false; s.Add(item1, 1); Assert.AreEqual(true, item1.IsCanActivateInvoked); Assert.AreEqual(false, item1.IsOnNavigatingFromInvoked); Assert.AreEqual(false, item1.IsOnNavigatingToInvoked); Assert.AreEqual(null, item1.POnNavigatingTo); Assert.AreEqual(false, item1.IsOnNavigatedToInvoked); Assert.AreEqual(null, item1.POnNavigatedTo); item1.CActivate = true; s.Add(item1, 1); Assert.AreEqual(true, item1.IsCanActivateInvoked); Assert.AreEqual(false, item1.IsOnNavigatingFromInvoked); Assert.AreEqual(true, item1.IsOnNavigatingToInvoked); Assert.AreEqual(1, item1.POnNavigatingTo); Assert.AreEqual(true, item1.IsOnNavigatedToInvoked); Assert.AreEqual(1, item1.POnNavigatedTo); Assert.AreEqual(1, s.Items.Count); Assert.AreEqual(item1, s.Items.ElementAt(0)); }
public void Initialization_With_Collection() { var item1 = new MySharedItem { Id = 1, Name = "A" }; var item2 = new MySharedItem { Id = 2, Name = "B" }; var sharedSource = new SharedSource <MySharedItem>().Load(new InitItemCollection <MySharedItem> { { item1, 1 }, { item2, 2 } }); Assert.AreEqual(false, item1.IsCanActivateInvoked); Assert.AreEqual(true, item1.IsOnNavigatingToInvoked); Assert.AreEqual(1, item1.POnNavigatingTo); Assert.AreEqual(true, item1.IsOnNavigatedToInvoked); Assert.AreEqual(1, item1.POnNavigatedTo); Assert.AreEqual(false, item2.IsCanActivateInvoked); Assert.AreEqual(true, item2.IsOnNavigatingToInvoked); Assert.AreEqual(2, item2.POnNavigatingTo); Assert.AreEqual(true, item2.IsOnNavigatedToInvoked); Assert.AreEqual(2, item2.POnNavigatedTo); }
public void Initialization_With_List() { var item1 = new MySharedItem { Id = 1, Name = "A" }; var item2 = new MySharedItem { Id = 2, Name = "B" }; var sharedSource = new SharedSource <MySharedItem>().Load(new List <MySharedItem> { item1, item2 }); Assert.AreEqual(false, item1.IsCanActivateInvoked); Assert.AreEqual(true, item1.IsOnNavigatingToInvoked); Assert.AreEqual(null, item1.POnNavigatingTo); Assert.AreEqual(true, item1.IsOnNavigatedToInvoked); Assert.AreEqual(null, item1.POnNavigatedTo); Assert.AreEqual(false, item2.IsCanActivateInvoked); Assert.AreEqual(true, item2.IsOnNavigatingToInvoked); Assert.AreEqual(null, item2.POnNavigatingTo); Assert.AreEqual(true, item2.IsOnNavigatedToInvoked); Assert.AreEqual(null, item2.POnNavigatedTo); }