コード例 #1
0
        public void Client_Find()
        {
            Client newClient = new Client("Dave", 2);

            newClient.Save();
            Client testClient = Client.Find(newClient.GetId());

            Console.WriteLine("Find: " + newClient.GetId() + " " + testClient.GetId());
            Assert.Equal(testClient, newClient);
        }
コード例 #2
0
        public void Client_IdPassesCorrectly()
        {
            Client testClient = new Client("Dave", 1);
            int    result     = testClient.GetId();

            Assert.Equal(0, result);
        }
コード例 #3
0
        public void Test3_FindCorrectClient()
        {
            Client testClient = new Client("ClientName", 1);

            testClient.Save();
            Client foundClient = Client.Find(testClient.GetId());

            Assert.Equal(testClient, foundClient);
        }
コード例 #4
0
ファイル: ClientTest.cs プロジェクト: aglines/csharp3-friday
        public void Test_Find_FindsClientInDatabase()
        {
            Client testClient = new Client("Pesron1", 1, "email");

            testClient.Save();
            Client foundClient = Client.Find(testClient.GetId());

            Assert.Equal(testClient, foundClient);
        }
コード例 #5
0
ファイル: ClientTest.cs プロジェクト: Rouz1130/hair-salon
        public void Test5_Find_FindClientInDatabase()
        {
            Client testClient = new Client("Robert",1);
              testClient.Save();

              Client foundClient = Client.Find(testClient.GetId());

              Assert.Equal(testClient, foundClient);
        }
コード例 #6
0
        public void Test_Find_FindsClientInDatabase()
        {
            Client testClient = new Client("Susan", "Portland", 1);

            testClient.Save();
            Client foundClient = Client.Find(testClient.GetId());

            Assert.Equal(testClient, foundClient);
        }
コード例 #7
0
 public HomeModule()
 {
     Get["/"] = _ => {
         Dictionary <string, object> model = new Dictionary <string, object> {
             { "clients", Client.GetAll() }, { "stylists", Stylist.GetAll() }
         };
         return(View["index.cshtml", model]);
     };
     Get["/clients"] = _ => {
         Dictionary <string, object> model = new Dictionary <string, object> {
             { "clients", Client.GetAll() }, { "stylists", Stylist.GetAll() }
         };
         return(View["clients.cshtml", model]);
     };
     Get["/stylists"] = _ => {
         Dictionary <string, object> model = new Dictionary <string, object> {
             { "clients", Client.GetAll() }, { "stylists", Stylist.GetAll() }
         };
         return(View["stylists.cshtml", model]);
     };
     Get["/clients/edit/{id}"] = parameters => {
         Client foundClient = Client.Find(parameters.id);
         return(View["client-edit.cshtml", foundClient]);
     };
     Get["/clients/view/{id}"] = parameters => {
         Client foundClient = Client.Find(parameters.id);
         return(View["client-details.cshtml", foundClient]);
     };
     Get["/stylists/view/{id}"] = parameters => {
         Stylist foundStylist = Stylist.Find(parameters.id);
         return(View["stylist-details.cshtml", foundStylist]);
     };
     Post["/clients/new"] = _ => {
         int    newStylistId = Request.Form["stylist-id"];
         Client newClient    = new Client(Request.Form["client-name"], newStylistId);
         newClient.Save();
         return(View["client-details.cshtml", newClient]);
     };
     Post["/stylists/new"] = _ => {
         Stylist newStylist = new Stylist(Request.Form["stylist-name"]);
         newStylist.Save();
         return(View["stylist-details.cshtml", newStylist]);
     };
     Patch["clients/edit/{id}"] = parameters => {
         Client foundClient = Client.Find(parameters.id);
         foundClient.Update(Request.Form["client-name"]);
         return(View["client-details.cshtml", foundClient]);
     };
     Delete["clients/delete/{id}"] = parameters => {
         Dictionary <string, object> model = new Dictionary <string, object> {
             { "clients", Client.GetAll() }, { "stylists", Stylist.GetAll() }
         };
         Client foundClient = Client.Find(parameters.id);
         Client.Delete(foundClient.GetId());
         return(View["index.cshtml", model]);
     };
 }
コード例 #8
0
ファイル: Client_Test.cs プロジェクト: GrapeSalad/Hair-Salon
        public void Test_FindClientInDatabase()
        {
            Client testClient = new Client("Chet", 2);

            testClient.Save();

            Client foundClient = Client.Find(testClient.GetId());

            Assert.Equal(testClient, foundClient);
        }
コード例 #9
0
        public void Test_Find_FindsClientInDatabase()
        {
            Client testClient = new Client("Susie", 1, "Monday", "11:30");

            testClient.Save();

            Client foundClient = Client.Find(testClient.GetId());

            Assert.Equal(testClient, foundClient);
        }
コード例 #10
0
        public void Test_Find_FindsClientInDatabase()
        {
            Client testClient = new Client("Mako", "Tips well, comes in once a week.", 1);

            testClient.Save();

            Client foundClient = Client.Find(testClient.GetId());

            Assert.Equal(testClient, foundClient);
        }
コード例 #11
0
        public void Test_IfCanFindByID_True()
        {
            Client newClient   = new Client("Joe Klein", 1);
            Client foundClient = new Client("Joe Klein", 1);

            newClient.Save();
            newClient = Client.FindById(newClient.GetId());

            Assert.Equal(foundClient, newClient);
        }
コード例 #12
0
ファイル: ClientTest.cs プロジェクト: aglines/csharp3-friday
        public void Test_Save_AssignsIdToObject()
        {
            Client testClient = new Client("Person1", 1, "email");

            testClient.Save();
            Client savedClient = Client.GetAll()[0];
            int    result      = savedClient.GetId();
            int    testId      = testClient.GetId();

            Assert.Equal(testId, result);
        }
コード例 #13
0
        public void Test2_Save()
        {
            Client testClient = new Client("ClientName", 1);

            testClient.Save();
            Client savedClient = Client.GetAll()[0];
            int    result      = savedClient.GetId();
            int    testId      = testClient.GetId();

            Assert.Equal(testId, result);
        }
コード例 #14
0
        public void Test_Save_AssignsIdToObject()
        {
            Client testClient = new Client("Susie", 1, "Monday", "11:30");

            testClient.Save();
            Client savedClient = Client.GetAll()[0];

            int result = savedClient.GetId();
            int testId = testClient.GetId();

            Assert.Equal(testId, result);
        }
コード例 #15
0
        public void Test_FindClient()
        {
            //Arrange
            Client search = new Client("Jimmy the Client", 1);

            //Act
            search.Save();
            Client found = Client.Find(search.GetId());

            //Assert
            Assert.Equal(search, found);
        }
コード例 #16
0
        public void TestClient_Find_ClientInDatabase()
        {
            Stylist newStylist = new Stylist("Jessica", 5);

            newStylist.Save();
            Client newClient = new Client("Tom", newStylist.GetId());

            newClient.Save();
            Client foundClient = Client.Find(newClient.GetId());

            Assert.Equal(newClient, foundClient);
        }
コード例 #17
0
        public void Test_Find_ClientInDatabase()
        {
            //Arrange
            Client testClient = new Client("Summer Smith", "785-267-7865", "*****@*****.**", 1);

            testClient.Save();
            //Act
            Client foundClient = Client.Find(testClient.GetId());

            //Assert
            Assert.Equal(testClient, foundClient);
        }
コード例 #18
0
        public void Test_Find_FindsClientInDatabase()
        {
            //Arrange
            Client testClient = new Client("Vin Diesel", 3);

            testClient.Save();
            //Act
            Client foundClient = Client.Find(testClient.GetId());

            //Assert
            Assert.Equal(testClient, foundClient);
        }
コード例 #19
0
ファイル: ClientTest.cs プロジェクト: Rouz1130/hair-salon
        public void Test3_Save_AssignsIdToObject()
        {
            Client testClient = new Client("Alex",1);

              testClient.Save();
              Client savedClient = Client.GetAll()[0];

              int result = savedClient.GetId();
              int testId = testClient.GetId();

              Assert.Equal(testId, result);
        }
コード例 #20
0
        public void Find_FindsClientById_true()
        {
            //Arrange
            Client newClient = new Client("Betty", 2);

            newClient.Save();
            //Act
            Client foundClient = Client.Find(newClient.GetId());

            //Assert
            Assert.Equal(newClient, foundClient);
        }
コード例 #21
0
        public void Test_Save_AssignsIdToObject()
        {
            Client testClient = new Client("Susan", "Portland", 1);

            testClient.Save();
            Client savedClient = Client.GetAll()[0];

            int result = savedClient.GetId();
            int testId = testClient.GetId();

            Assert.Equal(testId, result);
        }
コード例 #22
0
ファイル: ClientTest.cs プロジェクト: AnabelGR/HairSalon-CS
        public void TestClients_Find_FindsClientInDatabase()
        {
            //arrange
            Client newClient = new Client("Amber", 1);

            newClient.Save();

            //Act
            Client foundClient = Client.Find(newClient.GetId());

            //assert
            Assert.Equal(newClient, foundClient);
        }
コード例 #23
0
        public void Test_Save_AssignsIdToClientObject()
        {
            Client testClient = new Client("Mako", "Tips well, comes in once a week.", 1);

            testClient.Save();

            Client savedClient = Client.GetAll()[0];

            int testId = testClient.GetId();
            int result = savedClient.GetId();

            Assert.Equal(testId, result);
        }
コード例 #24
0
        public void T5_Find_DoesFindWork()
        {
            //Arrange
            Client testClient = new Client("Joe Lee", 1);

            testClient.Save();

            //Act
            Client foundClient = Client.Find(testClient.GetId());

            //Assert
            Assert.Equal(testClient, foundClient);
        }
コード例 #25
0
        public void Find_FindsClientInDatabase_specifiedClient()
        {
            //Arrange
            Client testClient = new Client("Veronique Moore", 2);

            testClient.Save();

            //Act
            Client foundClient = Client.Find(testClient.GetId());

            //Assert
            Assert.Equal(testClient, foundClient);
        }
コード例 #26
0
        public void Test_UpdateString_ReturnsTrueIfClientInfoIsTheSame()
        {
            //Arrange
            Client firstTestClient = new Client("Vin Diesel", 3);

            firstTestClient.Save();
            Client secondTestClient = new Client("Dwayne Johnson", 3, firstTestClient.GetId());

            //Act
            secondTestClient.UpdateString("Vin Diesel");
            //Assert
            Assert.Equal(firstTestClient, secondTestClient);
        }
コード例 #27
0
        public void Edit_UpdatesValues_true()
        {
            //Arrange
            Client newClient = new Client("client1", 2);

            newClient.Save();
            //Act
            newClient.Edit("Cliff", 1);
            Client foundClient    = Client.Find(newClient.GetId());
            Client expectedResult = new Client(newClient.GetName(), newClient.GetStylistId(), newClient.GetId());

            //Assert
            Assert.Equal(expectedResult, foundClient);
        }
コード例 #28
0
        public void Test_Save_AssignsIdToClientInDatabase()
        {
            //Arrange
            Client testClient = new Client("Vin Diesel", 3);

            testClient.Save();
            //Act
            Client savedClient = Client.GetAll()[0];
            int    testId      = testClient.GetId();
            int    expectedId  = savedClient.GetId();

            //Assert
            Assert.Equal(testId, expectedId);
        }
コード例 #29
0
        public void Test_ObjectFoundInDatabase_True()
        {
            Console.WriteLine("Client Test: Object Found In db");
            //Arrange
            Client testClient = new Client("Jordan Loop", 1);

            testClient.Save();

            //Act
            Client foundClient = Client.Find(testClient.GetId());

            //Assert
            Assert.Equal(testClient, foundClient);
        }
コード例 #30
0
 public override bool Equals(System.Object otherClient)
 {
     if (!(otherClient is Client))
     {
         return(false);
     }
     else
     {
         Client newClient       = (Client)otherClient;
         bool   idEquality      = (this.GetId() == newClient.GetId());
         bool   nameEquality    = (this.GetName() == newClient.GetName());
         bool   stylistEquality = (this.GetStylistId() == newClient.GetStylistId());
         return(idEquality && nameEquality && stylistEquality);
     }
 }
コード例 #31
0
        public void Test_FindClientFromStylist()
        {
            Stylist newStylist = new Stylist("Hilary", 1);

            newStylist.Save();

            Client controlClient = new Client("David", 1);

            controlClient.Save();

            Client newClient = Client.Find(controlClient.GetId());

            Console.WriteLine(newClient.GetName());

            Assert.Equal(controlClient.GetName(), newClient.GetName());
        }
コード例 #32
0
        public void Test_ChangeNameOfClient()
        {
            Client newClient = new Client("Hunter", 10);

            newClient.Save();

            Client testClient = Client.Find(newClient.GetId());

            testClient.Save();

            string newName = "Patrick";

            testClient.Update(newName);

            Assert.Equal(newName, testClient.GetName());
        }