forked from ddrilling/AsbCloudServer
Юнит-тесты для фактической траектории
This commit is contained in:
parent
8f61785b61
commit
2201b6582d
@ -1,10 +1,8 @@
|
||||
using AsbCloudApp.Data;
|
||||
using AsbCloudApp.Data.WITS;
|
||||
using AsbCloudApp.Repositories;
|
||||
using AsbCloudInfrastructure.Services;
|
||||
using AsbCloudInfrastructure.Services.Trajectory;
|
||||
using Moq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
@ -79,8 +77,11 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
var factualTrajectory = new Record7Dto[]
|
||||
{
|
||||
new() { Svyazc = 0, Svyinc = 0, Deptsvym = 0},
|
||||
new() { Svyazc = 30, Svyinc = 30, Deptsvym = 10},
|
||||
new() { Svyazc = 0, Svyinc = 0, Deptsvym = 0},
|
||||
new() { Svyazc = 0, Svyinc = 0, Deptsvym = 20},
|
||||
new() { Svyazc = 0, Svyinc = 0, Deptsvym = 20},
|
||||
new() { Svyazc = 0, Svyinc = 0, Deptsvym = 30},
|
||||
new() { Svyazc = 0, Svyinc = 0, Deptsvym = 50},
|
||||
};
|
||||
|
||||
var mockPlan = MakePlannedTrajectoryRepositoryMock(plannedTrajectory);
|
||||
@ -93,6 +94,10 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
Assert.Equal(0d, lastPointPlan.X, 0.1d);
|
||||
Assert.Equal(0d, lastPointPlan.Y, 0.1d);
|
||||
Assert.Equal(50d, lastPointPlan.Z, 0.1d);
|
||||
|
||||
Assert.Equal(0d, lastPointFact.X, 0.1d);
|
||||
Assert.Equal(0d, lastPointFact.Y, 0.1d);
|
||||
Assert.Equal(50d, lastPointFact.Z, 0.1d);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -117,11 +122,17 @@ namespace AsbCloudWebApi.Tests.ServicesTests
|
||||
var service = new TrajectoryVisualizationService(mockPlanned.Object, mockFactual.Object);
|
||||
var result = await service.GetTrajectoryAsync(1, CancellationToken.None);
|
||||
var lastPointPlan = result.Plan!.Last();
|
||||
var lastPointFact = result.Fact!.Last();
|
||||
var tolerancePlan = 0.001d;
|
||||
var toleranceFact = 0.001d;
|
||||
|
||||
Assert.InRange(lastPointPlan.Z, 10 + tolerancePlan, 20 - tolerancePlan);
|
||||
Assert.InRange(lastPointPlan.Y, 0 + tolerancePlan, 10 - tolerancePlan);
|
||||
Assert.InRange(lastPointPlan.X, 0 + tolerancePlan, 10 - tolerancePlan);
|
||||
|
||||
Assert.InRange(lastPointFact.Z, 10 + toleranceFact, 20 - toleranceFact);
|
||||
Assert.InRange(lastPointFact.Y, 0 + toleranceFact, 10 - toleranceFact);
|
||||
Assert.InRange(lastPointFact.X, 0 + toleranceFact, 10 - toleranceFact);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user