public void ReadAll_Create3Records_CountIs3() { //Assemble ProgramTypeModel programTypeModel1 = new ProgramTypeModel(); programTypeModel1.description = "Advanced"; ProgramTypeModel programTypeModel2 = new ProgramTypeModel(); programTypeModel2.description = "Regular"; ProgramTypeModel programTypeModel3 = new ProgramTypeModel(); programTypeModel3.description = "Advanced"; ProgramTypeTable programTypeTable = new ProgramTypeTable(); int expected = 3; //Act int programTypeID1 = programTypeTable.create(programTypeModel1); int programTypeID2 = programTypeTable.create(programTypeModel2); int programTypeID3 = programTypeTable.create(programTypeModel3); List <ProgramTypeModel> actual = programTypeTable.readAll(); //Assert Assert.AreEqual(expected, actual.Count); }
public void ReadAll_Create3Records_3DifferentRecords() { //Assemble ProgramTypeModel programTypeModel1 = new ProgramTypeModel(); programTypeModel1.description = "Advanced"; ProgramTypeModel programTypeModel2 = new ProgramTypeModel(); programTypeModel2.description = "Regular"; ProgramTypeModel programTypeModel3 = new ProgramTypeModel(); programTypeModel3.description = "Advanced"; ProgramTypeTable programTypeTable = new ProgramTypeTable(); //Act int programTypeID1 = programTypeTable.create(programTypeModel1); int programTypeID2 = programTypeTable.create(programTypeModel2); int programTypeID3 = programTypeTable.create(programTypeModel3); List <ProgramTypeModel> actual = programTypeTable.readAll(); //Assert Assert.AreEqual(programTypeID1, programTypeID1); Assert.AreEqual(programTypeModel1.description, actual[0].description); Assert.AreEqual(programTypeID2, programTypeID2); Assert.AreEqual(programTypeModel2.description, actual[1].description); Assert.AreEqual(programTypeID3, programTypeID3); Assert.AreEqual(programTypeModel3.description, actual[2].description); }
public void Setup() { new DataStoreTableHelper().clearAllTables(); ClientModel clientModel = new ClientModel(); clientModel.name = "Bob"; clientModel.phone = "1234567890"; clientModel.email = "*****@*****.**"; ClientTable clientTable = new ClientTable(); clientId = clientTable.create(clientModel); DogModel dogModel = new DogModel(); dogModel.clientID = clientId; dogModel.name = "Dog"; dogModel.age = 6; dogModel.breed = "Terrier"; dogModel.experienceOrQualification = false; DogTable dogTable = new DogTable(); dogId = dogTable.create(dogModel); ProgramTypeModel programTypeModel = new ProgramTypeModel(); programTypeModel.description = "Regular"; ProgramTypeTable programTypeTable = new ProgramTypeTable(); programTypeId = programTypeTable.create(programTypeModel); }
public void Setup() { new DataStoreTableHelper().clearAllTables(); ClientModel clientModel = new ClientModel(); clientModel.name = "Bob"; clientModel.phone = "1234567890"; clientModel.email = "*****@*****.**"; ClientTable clientTable = new ClientTable(); clientId = clientTable.create(clientModel); DogModel dogModel = new DogModel(); dogModel.clientID = clientId; dogModel.name = "Dog"; dogModel.age = 6; dogModel.breed = "Terrier"; dogModel.experienceOrQualification = false; DogTable dogTable = new DogTable(); dogId = dogTable.create(dogModel); ProgramTypeModel programTypeModel = new ProgramTypeModel(); programTypeModel.description = "Regular"; ProgramTypeTable programTypeTable = new ProgramTypeTable(); programTypeId = programTypeTable.create(programTypeModel); ProgramCostModel programeCostModel = new ProgramCostModel(); programeCostModel.depositAmount = 20.0; programeCostModel.sessionCost = 20.0; programeCostModel.fullPaymentPercentageDiscount = 20; ProgramCostTable programCostTable = new ProgramCostTable(); programeCostId = programCostTable.create(programeCostModel); ProgramModel programModel = new ProgramModel(); programModel.programTypeId = programTypeId; programModel.programCostId = programeCostId; programModel.dogSpacesMaximum = 50; programModel.noOfClasses = 50; ProgramTable programTable = new ProgramTable(); programId = programTable.create(programModel); }
public void Count_AllRecordsDeleted_0() { //Assemble int expected = 0; ProgramTypeTable programTypeTable = new ProgramTypeTable(); //Act int actual = programTypeTable.count(); //Assert Assert.AreEqual(expected, actual); }
public void Delete_NonExistantId_0() { //Assemble ProgramTypeTable programTypeTable = new ProgramTypeTable(); int expected = 0; //Act programTypeTable.delete(0); int actual = programTypeTable.count(); //Assert Assert.AreEqual(expected, actual); }
public void Read_CreatedAndRead1Record_CorrectValues() { //Assemble ProgramTypeModel programTypeModel = new ProgramTypeModel(); programTypeModel.description = "Advanced"; ProgramTypeTable programTypeTable = new ProgramTypeTable(); //Act int programTypeID = programTypeTable.create(programTypeModel); ProgramTypeModel actual = programTypeTable.read(programTypeID); //Assert Assert.AreEqual(programTypeModel.description, actual.description); }
public void Count_Created1Record_1() { //Assemble ProgramTypeModel programTypeModel = new ProgramTypeModel(); programTypeModel.description = "Advanced"; int expected = 1; ProgramTypeTable programTypeTable = new ProgramTypeTable(); //Act int programTypeID = programTypeTable.create(programTypeModel); int actual = programTypeTable.count(); //Assert Assert.AreEqual(expected, actual); }
public void Create_ValidData_ProgramTypeIDReturned() { //Assemble ProgramTypeModel programTypeModel = new ProgramTypeModel(); programTypeModel.description = "Advanced"; //If created will be greater than 0, but we don't know exactly what it will be because deleting all records doesnt set the ID counter back to 0 int notCreated = 0; ProgramTypeTable programTypeTable = new ProgramTypeTable(); //Act int actual = programTypeTable.create(programTypeModel); //Assert Assert.AreNotEqual(notCreated, actual); }
public void Setup() { new DataStoreTableHelper().clearAllTables(); ProgramTypeModel programTypeModel = new ProgramTypeModel(); programTypeModel.description = "Regular"; ProgramTypeTable programTypeTable = new ProgramTypeTable(); programTypeId = programTypeTable.create(programTypeModel); ProgramCostModel programeCostModel = new ProgramCostModel(); programeCostModel.depositAmount = 20.0; programeCostModel.sessionCost = 20.0; programeCostModel.fullPaymentPercentageDiscount = 20; ProgramCostTable programCostTable = new ProgramCostTable(); programeCostId = programCostTable.create(programeCostModel); ProgramModel programModel = new ProgramModel(); programModel.programTypeId = programTypeId; programModel.programCostId = programeCostId; programModel.dogSpacesMaximum = 50; programModel.noOfClasses = 50; ProgramTable programTable = new ProgramTable(); programId = programTable.create(programModel); StaffModel staffModel = new StaffModel(); staffModel.name = "Bob"; StaffTable staffTable = new StaffTable(); staffId = staffTable.create(staffModel); }
public void Update_CreatedUpdateAndRead1Record_UpdatedValues() { //Assemble ProgramTypeModel programTypeModel = new ProgramTypeModel(); programTypeModel.description = "Advanced"; ProgramTypeTable programTypeTable = new ProgramTypeTable(); int programTypeID = programTypeTable.create(programTypeModel); programTypeModel.id = programTypeID; programTypeModel.description = "Regular"; //Act programTypeTable.update(programTypeModel); ProgramTypeModel actual = programTypeTable.read(programTypeID); //Assert Assert.AreEqual(programTypeModel.description, actual.description); }
public void Setup() { new DataStoreTableHelper().clearAllTables(); ProgramTypeModel programTypeModel = new ProgramTypeModel(); programTypeModel.description = "Regular"; ProgramTypeTable programTypeTable = new ProgramTypeTable(); programTypeId = programTypeTable.create(programTypeModel); ProgramCostModel programeCostModel = new ProgramCostModel(); programeCostModel.depositAmount = 20.0; programeCostModel.sessionCost = 20.0; programeCostModel.fullPaymentPercentageDiscount = 20; ProgramCostTable programCostTable = new ProgramCostTable(); programCostId = programCostTable.create(programeCostModel); }
public void CreateDescriptionConstraint_DescriptionNull_Exception() { //Assemble ProgramTypeTable programTypeTable = new ProgramTypeTable(); ProgramTypeModel programTypeModel = new ProgramTypeModel(); programTypeModel.description = null; int expected = 1; int counter = 0; //Act try { int id = programTypeTable.create(programTypeModel); } catch (Exception ex) { counter++; } //Assert Assert.AreEqual(expected, counter); }