@@ -92,7 +92,7 @@ public async Task CheckThatInspectionAreaIsCorrectlyCreatedThroughEndpoint()
9292 }
9393
9494 [ Fact ]
95- public async Task CheckThatMissionDefinitionIsCreatedInInspectionAreaWhenSchedulingACustomMissionRun ( )
95+ public async Task CheckThatMissionDefinitionIsCreatedInInspectionAreaUponCreation ( )
9696 {
9797 // Arrange
9898 var installation = await DatabaseUtilities . NewInstallation ( ) ;
@@ -107,27 +107,25 @@ public async Task CheckThatMissionDefinitionIsCreatedInInspectionAreaWhenSchedul
107107 inspectionArea . Id
108108 ) ;
109109
110- var inspection = new CustomInspectionQuery
111- {
112- InspectionTarget = new Position ( ) ,
113- InspectionType = InspectionType . Image ,
114- } ;
115- var tasks = new List < CustomTaskQuery >
110+ var testName = Guid . NewGuid ( ) . ToString ( ) ;
111+
112+ var tasks = new List < TaskQuery >
116113 {
117114 new ( )
118115 {
119- Inspection = inspection ,
120116 TagId = "test" ,
121117 RobotPose = new Pose ( ) ,
122- TaskOrder = 0 ,
118+ TargetPosition = new Position ( ) ,
119+ SensorType = SensorType . Image ,
120+ AnalysisType = AnalysisType . Fencilla ,
121+ Description = "Test description" ,
123122 } ,
124123 } ;
125- var missionQuery = new CustomMissionQuery
124+ var missionQuery = new MissionQuery
126125 {
127126 RobotId = robot . Id ,
128- CreationTime = DateTime . UtcNow ,
129127 InstallationCode = installation . InstallationCode ,
130- Name = "TestMission" ,
128+ Name = testName ,
131129 Tasks = tasks ,
132130 } ;
133131
@@ -139,31 +137,23 @@ public async Task CheckThatMissionDefinitionIsCreatedInInspectionAreaWhenSchedul
139137
140138 // Act
141139 var missionResponse = await Client . PostAsync (
142- "/missions/custom " ,
140+ "/missions/definitions " ,
143141 missionContent ,
144142 TestContext . Current . CancellationToken
145143 ) ;
146- var userMissionResponse = await missionResponse . Content . ReadFromJsonAsync < MissionRun > (
147- SerializerOptions ,
148- cancellationToken : TestContext . Current . CancellationToken
149- ) ;
150144 var inspectionAreaMissionResponse = await Client . GetAsync (
151145 $ "/inspectionAreas/{ inspectionArea . Id } /mission-definitions",
152146 TestContext . Current . CancellationToken
153147 ) ;
154148
155149 // Assert
156- var mission = await MissionRunService . ReadById ( userMissionResponse ! . Id ) ;
157150 var missionDefinitions = await MissionDefinitionService . ReadByInspectionAreaId (
158151 inspectionArea . Id
159152 ) ;
160153
161154 Assert . True ( missionResponse . IsSuccessStatusCode ) ;
155+ Assert . NotNull ( missionDefinitions . Find ( ( m ) => m . Name == testName ) ) ;
162156 Assert . True ( inspectionAreaMissionResponse . IsSuccessStatusCode ) ;
163- Assert . Single (
164- missionDefinitions ,
165- m => m . Id . Equals ( mission ! . MissionId , StringComparison . Ordinal )
166- ) ;
167157 }
168158
169159 [ Fact ]
@@ -214,7 +204,7 @@ public async Task TestUpdatingInspectionAreaPolygon()
214204 }
215205
216206 [ Fact ]
217- public async Task ScheduleMissionOutsideInspectionAreaPolygonFails ( )
207+ public async Task CreateMissionDefinitionOutsideInspectionAreaPolygonFails ( )
218208 {
219209 // Arrange
220210 var installation = await DatabaseUtilities . NewInstallation ( ) ;
@@ -246,25 +236,20 @@ public async Task ScheduleMissionOutsideInspectionAreaPolygonFails()
246236
247237 var robot = await DatabaseUtilities . NewRobot ( RobotStatus . Available , installation ) ;
248238
249- var inspection = new CustomInspectionQuery
250- {
251- InspectionTarget = new Position ( ) ,
252- InspectionType = InspectionType . Image ,
253- } ;
254- var tasks = new List < CustomTaskQuery >
239+ var tasks = new List < TaskQuery >
255240 {
256241 new ( )
257242 {
258- Inspection = inspection ,
259243 TagId = "test" ,
244+ TargetPosition = new Position ( ) ,
245+ SensorType = SensorType . Image ,
246+ AnalysisType = AnalysisType . Fencilla ,
260247 RobotPose = new Pose ( 11 , 11 , 11 , 0 , 0 , 0 , 1 ) , // Position outside polygon
261- TaskOrder = 0 ,
262248 } ,
263249 } ;
264- var missionQuery = new CustomMissionQuery
250+ var missionQuery = new MissionQuery
265251 {
266252 RobotId = robot . Id ,
267- CreationTime = DateTime . UtcNow ,
268253 InstallationCode = installation . InstallationCode ,
269254 Name = "TestMission" ,
270255 Tasks = tasks ,
@@ -278,7 +263,7 @@ public async Task ScheduleMissionOutsideInspectionAreaPolygonFails()
278263
279264 // Act
280265 var missionResponse = await Client . PostAsync (
281- "/missions/custom " ,
266+ "/missions/definitions " ,
282267 missionContent ,
283268 TestContext . Current . CancellationToken
284269 ) ;
0 commit comments