Пример #1
0
        public void ReadAll_Create3Records_CountIs3()
        {
            //Assemble
            ProgramVarietyModel programVarietyModel1 = new ProgramVarietyModel();

            programVarietyModel1.depositAmount = 49.1;
            programVarietyModel1.sessionCost   = 50.1;
            programVarietyModel1.fullPaymentPercentageDiscount = 51.1;
            programVarietyModel1.name             = "Advanced";
            programVarietyModel1.noOfClasses      = 10;
            programVarietyModel1.dogSpacesMaximum = 9;


            ProgramVarietyModel programVarietyModel2 = new ProgramVarietyModel();

            programVarietyModel2.depositAmount = 49.2;
            programVarietyModel2.sessionCost   = 50.2;
            programVarietyModel2.fullPaymentPercentageDiscount = 51.2;
            programVarietyModel2.name             = "Advanced";
            programVarietyModel2.noOfClasses      = 8;
            programVarietyModel2.dogSpacesMaximum = 7;

            ProgramVarietyModel programVarietyModel3 = new ProgramVarietyModel();

            programVarietyModel3.depositAmount = 49.3;
            programVarietyModel3.sessionCost   = 50.3;
            programVarietyModel3.fullPaymentPercentageDiscount = 51.3;
            programVarietyModel3.name             = "Advanced";
            programVarietyModel3.noOfClasses      = 6;
            programVarietyModel3.dogSpacesMaximum = 5;

            ProgramVarietyTable programCostTable = new ProgramVarietyTable();
            int expected = 3;

            //Act
            int programCostID1 = programCostTable.create(programVarietyModel1);
            int programCostID2 = programCostTable.create(programVarietyModel2);
            int programCostID3 = programCostTable.create(programVarietyModel3);
            List <ProgramVarietyModel> actual = programCostTable.readAll();

            //Assert
            Assert.AreEqual(expected, actual.Count);
        }
Пример #2
0
        public void ReadAll_Create3Records_3DifferentRecords()
        {
            //Assemble
            ProgramVarietyModel programVarietyModel1 = new ProgramVarietyModel();

            programVarietyModel1.depositAmount = 49.1;
            programVarietyModel1.sessionCost   = 50.1;
            programVarietyModel1.fullPaymentPercentageDiscount = 51.1;
            programVarietyModel1.name             = "Advanced";
            programVarietyModel1.noOfClasses      = 10;
            programVarietyModel1.dogSpacesMaximum = 9;

            ProgramVarietyModel programVarietyModel2 = new ProgramVarietyModel();

            programVarietyModel2.depositAmount = 49.2;
            programVarietyModel2.sessionCost   = 50.2;
            programVarietyModel2.fullPaymentPercentageDiscount = 51.2;
            programVarietyModel2.name             = "Regular";
            programVarietyModel2.noOfClasses      = 8;
            programVarietyModel2.dogSpacesMaximum = 7;

            ProgramVarietyModel programVarietyModel3 = new ProgramVarietyModel();

            programVarietyModel3.depositAmount = 49.3;
            programVarietyModel3.sessionCost   = 50.3;
            programVarietyModel3.fullPaymentPercentageDiscount = 51.3;
            programVarietyModel3.name             = "Advanced";
            programVarietyModel3.noOfClasses      = 6;
            programVarietyModel3.dogSpacesMaximum = 5;

            ProgramVarietyTable programCostTable = new ProgramVarietyTable();

            //Act
            int programCostID1 = programCostTable.create(programVarietyModel1);
            int programCostID2 = programCostTable.create(programVarietyModel2);
            int programCostID3 = programCostTable.create(programVarietyModel3);
            List <ProgramVarietyModel> actual = programCostTable.readAll();

            //Assert
            Assert.AreEqual(programCostID1, programCostID1);
            Assert.AreEqual(programVarietyModel1.depositAmount, actual[0].depositAmount);
            Assert.AreEqual(programVarietyModel1.sessionCost, actual[0].sessionCost);
            Assert.AreEqual(programVarietyModel1.fullPaymentPercentageDiscount, actual[0].fullPaymentPercentageDiscount);
            Assert.AreEqual(programVarietyModel1.name, actual[0].name);
            Assert.AreEqual(programVarietyModel1.dogSpacesMaximum, actual[0].dogSpacesMaximum);
            Assert.AreEqual(programVarietyModel1.noOfClasses, actual[0].noOfClasses);

            Assert.AreEqual(programCostID2, programCostID2);
            Assert.AreEqual(programVarietyModel2.depositAmount, actual[1].depositAmount);
            Assert.AreEqual(programVarietyModel2.sessionCost, actual[1].sessionCost);
            Assert.AreEqual(programVarietyModel2.fullPaymentPercentageDiscount, actual[1].fullPaymentPercentageDiscount);
            Assert.AreEqual(programVarietyModel2.name, actual[1].name);
            Assert.AreEqual(programVarietyModel2.dogSpacesMaximum, actual[1].dogSpacesMaximum);
            Assert.AreEqual(programVarietyModel2.noOfClasses, actual[1].noOfClasses);


            Assert.AreEqual(programCostID3, programCostID3);
            Assert.AreEqual(programVarietyModel3.depositAmount, actual[2].depositAmount);
            Assert.AreEqual(programVarietyModel3.sessionCost, actual[2].sessionCost);
            Assert.AreEqual(programVarietyModel3.fullPaymentPercentageDiscount, actual[2].fullPaymentPercentageDiscount);
            Assert.AreEqual(programVarietyModel3.name, actual[2].name);
            Assert.AreEqual(programVarietyModel3.dogSpacesMaximum, actual[2].dogSpacesMaximum);
            Assert.AreEqual(programVarietyModel3.noOfClasses, actual[2].noOfClasses);
        }