public void MOdifyTest() { SubscriptionMog testMog = new SubscriptionMog(test); testUnit.Add(test); testUnit.Commit(); string testJson = JsonConvert.SerializeObject(test); Subscription modified = JsonConvert.DeserializeObject <Subscription>(testJson); modified.Location = "Updated location"; var modifiedMog = new SubscriptionMog(modified); var feedback = testUnit.GetByID(test.ID); var feedbackMog = new SubscriptionMog(feedback); Assert.IsTrue(feedbackMog.Equals(testMog)); Assert.AreEqual(testUnit.UpdateList().Count, 0); testUnit.Modify(modified); Assert.AreEqual(testUnit.UpdateList().Count, 1); testUnit.Commit(); Assert.AreEqual(testUnit.UpdateList().Count, 0); feedback = testUnit.GetByID(test.ID); feedbackMog = new SubscriptionMog(feedback); Assert.IsTrue(feedbackMog.Equals(modifiedMog)); Assert.IsFalse(feedbackMog.Equals(testMog)); }
public void GetbyIdTest() { Assert.AreEqual(testUnit.ReadDict().Count, 0); testUnit.Add(test); testUnit.Commit(); var feedback = testUnit.GetByID(test.ID); Assert.AreEqual(testUnit.ReadDict().Count, 1); var feedbackMog = new SubscriptionMog(feedback); Assert.AreEqual(test.ID, feedback.ID); Assert.IsTrue(testMog.Equals(feedbackMog)); Assert.IsNull(testUnit.GetByID("not exhist")); }