コード例 #1
0
        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);
        }
コード例 #2
0
 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;
 }
コード例 #3
0
        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();
            }
        }
コード例 #4
0
 public void Delete()
 {
     try
     {
         db.Assistants.DeleteOnSubmit(currentAssistant);
         Submit();
         currentAssistant = null;
     }
     catch (Exception)
     {
         throw new DeleteException();
     }
 }
コード例 #5
0
 public AssistantHandler(Assistants assistant)
 {
     currentAssistant = assistant;
 }
コード例 #6
0
 partial void DeleteAssistants(Assistants instance);
コード例 #7
0
 partial void UpdateAssistants(Assistants instance);
コード例 #8
0
 partial void InsertAssistants(Assistants instance);
コード例 #9
0
 partial void DeleteAssistants(Assistants instance);
コード例 #10
0
 partial void UpdateAssistants(Assistants instance);
コード例 #11
0
 partial void InsertAssistants(Assistants instance);
コード例 #12
0
 public void AssistantHandlerConstructorTest()
 {
     Assistants assistant = new Assistants();
     AssistantHandler assistantHandler = new AssistantHandler(assistant);
     Assert.AreSame(assistant, assistantHandler.CurrentAssistant);
 }
コード例 #13
0
        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();
        }