public void testGetMarinaCapacity() { //arrange int expected = 51; //act' MarinaMaintenanceObj MarinaMaintenance_Obj = new MarinaMaintenanceObj(); Marina Marina = new Marina(); Marina._LoadDataFromFile(); Assert.AreEqual(expected, Marina.getCurrentCapacityMarinaLength()); }
public void createBoatTest() { NarrowBoat NB = new NarrowBoat(); NB.BoatDraft = 3; NB.BoatLength = 15; NB.NameOfBoat = "Phantom Menance"; NB.NameOfOwner = "Anakin Skywalker"; MarinaMaintenanceObj MarinaMaintenance_Obj = new MarinaMaintenanceObj(); Marina Marina = new Marina(); Marina.ClearAllMarinaItems(); //add new boat to marina Marina.addBoatToMarina(NB); List <string> listData = new List <string>(); listData = Marina.convertMarinaToList(); //write to file FileOperations FP = new FileOperations(); FP.writeToFile(listData); int index = Marina.getCurrentCapacityMarinaLength(); List <string> list = new List <string>(); list = FP.readDataFromFile(); string nameOflastBoatInList = list.Last(); //split array at commas and put result into an array string[] arrSplitRow = nameOflastBoatInList.Split(",".ToCharArray()); string actual = arrSplitRow[1]; Assert.AreEqual(actual.ToUpper(), NB.NameOfOwner.ToUpper()); }