Esempio n. 1
0
        public void TestUDCListModel()
        {
            UDCListModel udc = new UDCListModel("Data Source=isostore:/Test1.sdf", true);
            UserModel testUser = new UserModel("1", "foo", "bar", "");
            udc.addUser(testUser);

            Assert.Equals(testUser, udc.UsersByFirstName[0]);
            Assert.IsTrue(udc.SubmitChanges());

            udc.LoadListsFromDatabase();

            Assert.Equals(testUser, udc.UsersByFirstName[0]);

            GroupModel testGroup = new GroupModel("TestGroup");
            udc.addGroup(testGroup);
            udc.addToGroup(testUser, testGroup);

            Assert.IsTrue(udc.GroupList[0].Users.Contains(testUser));

            CallLogEntry testEntry = new CallLogEntry();
            CallLogModel testLog = new CallLogModel(1);
            testLog.addEntry(testEntry);
            testUser.CallLogs.Add(testLog);

            Assert.IsTrue(udc.SubmitChanges());
            Assert.IsTrue(testUser.CallLogs.Any());
            Assert.Equals(testUser.CallLogs.First(), testLog);

            udc.removeGroup("TestGroup");
            Assert.IsTrue(udc.GroupList.Count == 0);
        }
Esempio n. 2
0
 private void detachCallLog(CallLogModel cm)
 {
     NotifyPropertyChanging("CallLogModel");
     cm.User = null;
     NotifyOfPropertyChange("CallLogModel");
 }
Esempio n. 3
0
 private void attachCallLog(CallLogModel cm)
 {
     NotifyPropertyChanging("CallLogModel");
     cm.User = this;
     NotifyOfPropertyChange("CallLogModel");
 }