public void getAssistantByIdTest()
        {
            Assistants a = new Assistants { ID = "test", name = "test", password = "******" };
            AssistantHandler.DB.Assistants.InsertOnSubmit(a);
            AssistantHandler.DB.SubmitChanges();

            Assistants expected = AssistantHandler.DB.Assistants.First(assistant => assistant.ID == "test");
            Assistants actual = AssistantHandler.getAssistantById("test");

            AssistantHandler.DB.Assistants.DeleteOnSubmit(a);
            AssistantHandler.DB.SubmitChanges();
            Assert.AreSame(expected, actual);
        }
 protected bool register(string id, string pwd, string name)
 {
     Assistants a = new Assistants { ID=id,name=name,password=pwd};
     AssistantHandler ah = new AssistantHandler(a);
     try
     {
         ah.Insert();
     }
     catch (Exception)
     {
         return false;
     }
     return true;
 }
        public void DeleteTest()
        {
            Assistants a = new Assistants { ID = "test", name = "test", password = "******" };
            AssistantHandler.DB.Assistants.InsertOnSubmit(a);
            AssistantHandler.DB.SubmitChanges();
            AssistantHandler ah = new AssistantHandler(a);
            ah.Delete();
            Assert.IsFalse(AssistantHandler.DB.Assistants.Any(assistant => assistant.ID == "test"));

            if (AssistantHandler.DB.Assistants.Any(assistant => assistant.ID == "test"))
            {
                AssistantHandler.DB.Assistants.DeleteOnSubmit(a);
                AssistantHandler.DB.SubmitChanges();
            }
        }
 public void Delete()
 {
     try
     {
         db.Assistants.DeleteOnSubmit(currentAssistant);
         Submit();
         currentAssistant = null;
     }
     catch (Exception)
     {
         throw new DeleteException();
     }
 }
 public AssistantHandler(Assistants assistant)
 {
     currentAssistant = assistant;
 }
 partial void DeleteAssistants(Assistants instance);
 partial void UpdateAssistants(Assistants instance);
 partial void InsertAssistants(Assistants instance);
Exemple #9
0
 partial void DeleteAssistants(Assistants instance);
Exemple #10
0
 partial void UpdateAssistants(Assistants instance);
Exemple #11
0
 partial void InsertAssistants(Assistants instance);
 public void AssistantHandlerConstructorTest()
 {
     Assistants assistant = new Assistants();
     AssistantHandler assistantHandler = new AssistantHandler(assistant);
     Assert.AreSame(assistant, assistantHandler.CurrentAssistant);
 }
        public void SubmitTest()
        {
            Assistants a = new Assistants { ID = "test", name = "test", password = "******" };
            AssistantHandler.DB.Assistants.InsertOnSubmit(a);
            AssistantHandler ah = new AssistantHandler(a);
            ah.Submit();

            Assert.IsTrue(AssistantHandler.DB.Assistants.First(assistant => assistant.ID == "test").Equals(a));

            AssistantHandler.DB.Assistants.DeleteOnSubmit(a);
            AssistantHandler.DB.SubmitChanges();
        }