Exemplo n.º 1
0
        public void ReadAll_Create3Records_CountIs3()
        {
            //Assemble
            ClientModel clientModel1 = new ClientModel();

            clientModel1.name  = "Bob";
            clientModel1.phone = "07561 101169";
            clientModel1.email = "*****@*****.**";

            ClientModel clientModel2 = new ClientModel();

            clientModel2.name  = "Bob2";
            clientModel2.phone = "07561 101169";
            clientModel2.email = "*****@*****.**";

            ClientModel clientModel3 = new ClientModel();

            clientModel3.name  = "Bob3";
            clientModel3.phone = "07561 101169";
            clientModel3.email = "*****@*****.**";

            ClientTable clientTable = new ClientTable();
            int         expected    = 3;

            //Act
            int clientID1             = clientTable.create(clientModel1);
            int clientID2             = clientTable.create(clientModel2);
            int clientID3             = clientTable.create(clientModel3);
            List <ClientModel> actual = clientTable.readAll();

            //Assert
            Assert.AreEqual(expected, actual.Count);
        }
Exemplo n.º 2
0
        public void ReadAll_Create3Records_3DifferentRecords()
        {
            //Assemble
            ClientModel clientModel1 = new ClientModel();

            clientModel1.name  = "name1";
            clientModel1.phone = "07561 101169";
            clientModel1.email = "*****@*****.**";

            ClientModel clientModel2 = new ClientModel();

            clientModel2.name  = "name2";
            clientModel2.phone = "07561 101170";
            clientModel2.email = "*****@*****.**";

            ClientModel clientModel3 = new ClientModel();

            clientModel3.name  = "name3";
            clientModel3.phone = "07561 101171";
            clientModel3.email = "*****@*****.**";

            ClientTable clientTable = new ClientTable();

            //Act
            int clientID1             = clientTable.create(clientModel1);
            int clientID2             = clientTable.create(clientModel2);
            int clientID3             = clientTable.create(clientModel3);
            List <ClientModel> actual = clientTable.readAll();

            //Assert
            Assert.AreEqual(clientID1, clientID1);
            Assert.AreEqual(clientModel1.name, actual[0].name);
            Assert.AreEqual(clientModel1.phone, actual[0].phone);
            Assert.AreEqual(clientModel1.email, actual[0].email);

            Assert.AreEqual(clientID2, clientID2);
            Assert.AreEqual(clientModel2.name, actual[1].name);
            Assert.AreEqual(clientModel2.phone, actual[1].phone);
            Assert.AreEqual(clientModel2.email, actual[1].email);

            Assert.AreEqual(clientID3, clientID3);
            Assert.AreEqual(clientModel3.name, actual[2].name);
            Assert.AreEqual(clientModel3.phone, actual[2].phone);
            Assert.AreEqual(clientModel3.email, actual[2].email);
        }