public void GetNextPlotNumber() { var unitCode = "u1"; var plotNumber = 1; var plotID = Guid.NewGuid().ToString(); var cruiseID = CruiseID; using (var database = CreateDatabase()) { var datastore = new CuttingUnitDatastore(database, cruiseID, TestDeviceInfoService.TEST_DEVICEID, new SamplerInfoDataservice(database, CruiseID, TestDeviceInfoService.TEST_DEVICEID)); datastore.GetNextPlotNumber(unitCode).Should().Be(1, "unit with no plots, should return 1 for first plot number"); database.Execute($"INSERT INTO Plot (CruiseID, PlotID, CuttingUnitCode, PlotNumber) VALUES ('{cruiseID}', '{plotID}', '{unitCode}', {plotNumber});"); datastore.GetNextPlotNumber(unitCode).Should().Be(plotNumber + 1, "unit with a plot, should return max plot number + 1"); } }