Example #1
0
        public void ReadAll_Create3Records_3DifferentRecords()
        {
            //Assemble
            DogModel dogModel1 = new DogModel();

            dogModel1.name     = "Ted";
            dogModel1.clientID = clientId;
            dogModel1.age      = 8;
            dogModel1.breed    = "Shi Tzu";
            dogModel1.experienceOrQualification = false;

            DogModel dogModel2 = new DogModel();

            dogModel2.name     = "Ted 2";
            dogModel2.clientID = clientId;
            dogModel2.age      = 82;
            dogModel2.breed    = "Shi Tzu 2";
            dogModel2.experienceOrQualification = true;

            DogModel dogModel3 = new DogModel();

            dogModel3.name     = "Ted 3";
            dogModel3.clientID = clientId;
            dogModel3.age      = 83;
            dogModel3.breed    = "Shi Tzu 3";
            dogModel3.experienceOrQualification = false;

            DogTable dogTable = new DogTable();

            //Act
            int             dogID1 = dogTable.create(dogModel1);
            int             dogID2 = dogTable.create(dogModel2);
            int             dogID3 = dogTable.create(dogModel3);
            List <DogModel> actual = dogTable.readAll();

            //Assert
            Assert.AreEqual(dogID1, dogID1);
            Assert.AreEqual(dogModel1.name, actual[0].name);
            Assert.AreEqual(dogModel1.clientID, actual[0].clientID);
            Assert.AreEqual(dogModel1.age, actual[0].age);
            Assert.AreEqual(dogModel1.breed, actual[0].breed);
            Assert.AreEqual(dogModel1.experienceOrQualification, actual[0].experienceOrQualification);

            Assert.AreEqual(dogID2, dogID2);
            Assert.AreEqual(dogModel2.name, actual[1].name);
            Assert.AreEqual(dogModel2.clientID, actual[1].clientID);
            Assert.AreEqual(dogModel2.age, actual[1].age);
            Assert.AreEqual(dogModel2.breed, actual[1].breed);
            Assert.AreEqual(dogModel2.experienceOrQualification, actual[1].experienceOrQualification);

            Assert.AreEqual(dogID3, dogID3);
            Assert.AreEqual(dogModel3.name, actual[2].name);
            Assert.AreEqual(dogModel3.clientID, actual[2].clientID);
            Assert.AreEqual(dogModel3.age, actual[2].age);
            Assert.AreEqual(dogModel3.breed, actual[2].breed);
            Assert.AreEqual(dogModel3.experienceOrQualification, actual[2].experienceOrQualification);
        }
Example #2
0
        public void ReadAll_Create3Records_CountIs3()
        {
            //Assemble
            DogModel dogModel1 = new DogModel();

            dogModel1.name     = "Ted";
            dogModel1.clientID = clientId;
            dogModel1.age      = 8;
            dogModel1.breed    = "Shi Tzu";
            dogModel1.experienceOrQualification = false;

            DogModel dogModel2 = new DogModel();

            dogModel2.name     = "Ted 2";
            dogModel2.clientID = clientId;
            dogModel2.age      = 82;
            dogModel2.breed    = "Shi Tzu 2";
            dogModel2.experienceOrQualification = true;

            DogModel dogModel3 = new DogModel();

            dogModel3.name     = "Ted 3";
            dogModel3.clientID = clientId;
            dogModel3.age      = 83;
            dogModel3.breed    = "Shi Tzu 3";
            dogModel3.experienceOrQualification = false;

            DogTable dogTable = new DogTable();
            int      expected = 3;

            //Act
            int             dogID1 = dogTable.create(dogModel1);
            int             dogID2 = dogTable.create(dogModel2);
            int             dogID3 = dogTable.create(dogModel3);
            List <DogModel> actual = dogTable.readAll();

            //Assert
            Assert.AreEqual(expected, actual.Count);
        }