osago rewrite and tests
This commit is contained in:
parent
437e6e86a2
commit
194c44b4ef
@ -33,11 +33,23 @@ namespace ELT.Client.Managers.Insurance
|
||||
|
||||
var tasks = calculateOsagoRequest.CompanyIds.Distinct().Select(companyId => new Task(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
osagoParams.InsuranceCompany = companyId;
|
||||
var res = _eltOsagoSoap.OSAGOFullCalculation(osagoParams);
|
||||
if (string.IsNullOrEmpty(res.Error))
|
||||
result.Add(companyId, res);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}));
|
||||
|
||||
var tasksArray = tasks as Task[] ?? tasks.ToArray();
|
||||
Parallel.ForEach(tasksArray, (t) => t.Start());
|
||||
Task.WaitAll(tasksArray.ToArray());
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
304
ELT.Tests/Controllers/InsuranceController/Osago.cs
Normal file
304
ELT.Tests/Controllers/InsuranceController/Osago.cs
Normal file
@ -0,0 +1,304 @@
|
||||
using ELT.Client.Models.Insurance;
|
||||
using ELT.Client.Models.Insurance.Request;
|
||||
using ELTOsago;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Xunit;
|
||||
|
||||
namespace ELT.Tests.Controllers.InsuranceController
|
||||
{
|
||||
public class Osago
|
||||
{
|
||||
[Fact]
|
||||
public void Test1()
|
||||
{
|
||||
var TARGET_INSURANCE_COMPANY = "VSK";
|
||||
var request = new CalculateOsagoRequest()
|
||||
{
|
||||
CompanyIds = new[] { TARGET_INSURANCE_COMPANY },
|
||||
Preparams = new Preparams
|
||||
{
|
||||
RegionName = "Рязанская обл",
|
||||
CityName = "Рязань г",
|
||||
BrandId = "C3B16998-C04D-484C-A17E-DB2C8FFE6DF3",
|
||||
ModelId = "29DF0E37-1431-4037-AC0A-0FCA37AD0792"
|
||||
},
|
||||
ELTParams = new OSAGOFullCalculationRequest
|
||||
{
|
||||
InsurerType = 1,
|
||||
OwnerType = 1,
|
||||
ContractOptionId = 1,
|
||||
ContractStatusId = 13,
|
||||
UsagePlace = "6200000100000",
|
||||
TSToRegistrationPlace = 0,
|
||||
ContractBeginDate = DateTime.Now,
|
||||
Duration = 12,
|
||||
CarInfo = new OSAGOFullCalculationCarInfo
|
||||
{
|
||||
Mark = "AUDI",
|
||||
Model = "A4",
|
||||
VehicleYear = "2021",
|
||||
VehiclePower = 160,
|
||||
TSType = new TSType
|
||||
{
|
||||
Category = "B",
|
||||
Subcategory = "10"
|
||||
}
|
||||
},
|
||||
GrossViolations = false,
|
||||
Owner = new PhysicalPerson
|
||||
{
|
||||
SubjectTypeSpecified = true,
|
||||
SubjectType = 1,
|
||||
OPF = 1,
|
||||
JuridicalName = "ООО ЛК ЭВОЛЮЦИЯ",
|
||||
INN = "9724016636",
|
||||
KPP = "772401001",
|
||||
OGRN = "1207700245037",
|
||||
RegistrationDocument = new JuridicalDocument
|
||||
{
|
||||
Series = "0",
|
||||
//Number = "0",
|
||||
IssuedDate = new DateTime(2020, 07, 20)
|
||||
},
|
||||
RegistrationAddress = new Address
|
||||
{
|
||||
Resident = 1,
|
||||
Country = "Российская Федерация",
|
||||
Region = "Москва",
|
||||
City = "Москва",
|
||||
CityKLADR = "7700000000000",
|
||||
Street = "ул.Котляковская",
|
||||
House = "8",
|
||||
Flat = "337"
|
||||
},
|
||||
FactAddress = new Address
|
||||
{
|
||||
Resident = 1,
|
||||
Country = "Российская Федерация",
|
||||
Region = "Москва",
|
||||
City = "Москва",
|
||||
CityKLADR = "7700000000000",
|
||||
Street = "ул.Котляковская",
|
||||
House = "8",
|
||||
Flat = "337"
|
||||
},
|
||||
Phone = "8 (800) 333-75-75",
|
||||
Email = "client@evoleasing.ru"
|
||||
},
|
||||
DriversCount = 0,
|
||||
FullDriversInfo = new FullDriver[]
|
||||
{
|
||||
new FullDriver
|
||||
{
|
||||
KBM="13"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
var insuranceController = new ELT.Controllers.InsuranceController();
|
||||
Dictionary<string, OSAGOFullCalculationResponse> res
|
||||
= insuranceController.CalculateOsago(request).Value;
|
||||
Assert.True(res.Count > 0);
|
||||
Assert.Equal(String.Empty, res[TARGET_INSURANCE_COMPANY].Error);
|
||||
Assert.NotEqual(0, res[TARGET_INSURANCE_COMPANY].NumCalc);
|
||||
|
||||
}
|
||||
[Fact]
|
||||
public void Test2()
|
||||
{
|
||||
var TARGET_INSURANCE_COMPANY = "RESO_GARANTIJA";
|
||||
var request = new CalculateOsagoRequest()
|
||||
{
|
||||
CompanyIds = new[] { TARGET_INSURANCE_COMPANY },
|
||||
Preparams = new Preparams
|
||||
{
|
||||
RegionName = "Рязанская обл",
|
||||
CityName = "Рязань г",
|
||||
BrandId = "C3B16998-C04D-484C-A17E-DB2C8FFE6DF3",
|
||||
ModelId = "29DF0E37-1431-4037-AC0A-0FCA37AD0792"
|
||||
},
|
||||
ELTParams = new OSAGOFullCalculationRequest
|
||||
{
|
||||
InsurerType = 1,
|
||||
OwnerType = 1,
|
||||
ContractOptionId = 1,
|
||||
ContractStatusId = 13,
|
||||
UsagePlace = "6200000100000",
|
||||
TSToRegistrationPlace = 0,
|
||||
ContractBeginDate = DateTime.Now,
|
||||
Duration = 12,
|
||||
CarInfo = new OSAGOFullCalculationCarInfo
|
||||
{
|
||||
Mark = "AUDI",
|
||||
Model = "A4",
|
||||
VehicleYear = "2021",
|
||||
VehiclePower = 160,
|
||||
TSType = new TSType
|
||||
{
|
||||
Category = "B",
|
||||
Subcategory = "10"
|
||||
}
|
||||
},
|
||||
GrossViolations = false,
|
||||
Owner = new PhysicalPerson
|
||||
{
|
||||
SubjectTypeSpecified = true,
|
||||
SubjectType = 1,
|
||||
OPF = 1,
|
||||
JuridicalName = "ООО ЛК ЭВОЛЮЦИЯ",
|
||||
INN = "9724016636",
|
||||
KPP = "772401001",
|
||||
OGRN = "1207700245037",
|
||||
RegistrationDocument = new JuridicalDocument
|
||||
{
|
||||
Series = "0",
|
||||
//Number = "0",
|
||||
IssuedDate = new DateTime(2020, 07, 20)
|
||||
},
|
||||
RegistrationAddress = new Address
|
||||
{
|
||||
Resident = 1,
|
||||
Country = "Российская Федерация",
|
||||
Region = "Москва",
|
||||
City = "Москва",
|
||||
CityKLADR = "7700000000000",
|
||||
Street = "ул.Котляковская",
|
||||
House = "8",
|
||||
Flat = "337"
|
||||
},
|
||||
FactAddress = new Address
|
||||
{
|
||||
Resident = 1,
|
||||
Country = "Российская Федерация",
|
||||
Region = "Москва",
|
||||
City = "Москва",
|
||||
CityKLADR = "7700000000000",
|
||||
Street = "ул.Котляковская",
|
||||
House = "8",
|
||||
Flat = "337"
|
||||
},
|
||||
Phone = "8 (800) 333-75-75",
|
||||
Email = "client@evoleasing.ru"
|
||||
},
|
||||
DriversCount = 0,
|
||||
FullDriversInfo = new FullDriver[]
|
||||
{
|
||||
new FullDriver
|
||||
{
|
||||
KBM="13"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
var insuranceController = new ELT.Controllers.InsuranceController();
|
||||
Dictionary<string, OSAGOFullCalculationResponse> res
|
||||
= insuranceController.CalculateOsago(request).Value;
|
||||
Assert.True(res.Count > 0);
|
||||
Assert.Equal(String.Empty, res[TARGET_INSURANCE_COMPANY].Error);
|
||||
Assert.NotEqual(0, res[TARGET_INSURANCE_COMPANY].NumCalc);
|
||||
|
||||
}
|
||||
[Fact]
|
||||
public void Test3()
|
||||
{
|
||||
var TARGET_INSURANCE_COMPANY = "SOGLASIE_MSK";
|
||||
var request = new CalculateOsagoRequest()
|
||||
{
|
||||
CompanyIds = new[] { TARGET_INSURANCE_COMPANY },
|
||||
Preparams = new Preparams
|
||||
{
|
||||
RegionName = "Рязанская обл",
|
||||
CityName = "Рязань г",
|
||||
BrandId = "C3B16998-C04D-484C-A17E-DB2C8FFE6DF3",
|
||||
ModelId = "29DF0E37-1431-4037-AC0A-0FCA37AD0792"
|
||||
},
|
||||
ELTParams = new OSAGOFullCalculationRequest
|
||||
{
|
||||
InsurerType = 1,
|
||||
OwnerType = 1,
|
||||
ContractOptionId = 1,
|
||||
ContractStatusId = 13,
|
||||
UsagePlace = "6200000100000",
|
||||
TSToRegistrationPlace = 0,
|
||||
ContractBeginDate = DateTime.Now,
|
||||
Duration = 12,
|
||||
CarInfo = new OSAGOFullCalculationCarInfo
|
||||
{
|
||||
Mark = "AUDI",
|
||||
Model = "A4",
|
||||
VehicleYear = "2021",
|
||||
VehiclePower = 160,
|
||||
TSType = new TSType
|
||||
{
|
||||
Category = "B",
|
||||
Subcategory = "10"
|
||||
}
|
||||
},
|
||||
GrossViolations = false,
|
||||
Owner = new PhysicalPerson
|
||||
{
|
||||
SubjectTypeSpecified = true,
|
||||
SubjectType = 1,
|
||||
OPF = 1,
|
||||
JuridicalName = "ООО ЛК ЭВОЛЮЦИЯ",
|
||||
INN = "9724016636",
|
||||
KPP = "772401001",
|
||||
OGRN = "1207700245037",
|
||||
RegistrationDocument = new JuridicalDocument
|
||||
{
|
||||
Series = "0",
|
||||
//Number = "0",
|
||||
IssuedDate = new DateTime(2020, 07, 20)
|
||||
},
|
||||
RegistrationAddress = new Address
|
||||
{
|
||||
Resident = 1,
|
||||
Country = "Российская Федерация",
|
||||
Region = "Москва",
|
||||
City = "Москва",
|
||||
CityKLADR = "7700000000000",
|
||||
Street = "ул.Котляковская",
|
||||
House = "8",
|
||||
Flat = "337"
|
||||
},
|
||||
FactAddress = new Address
|
||||
{
|
||||
Resident = 1,
|
||||
Country = "Российская Федерация",
|
||||
Region = "Москва",
|
||||
City = "Москва",
|
||||
CityKLADR = "7700000000000",
|
||||
Street = "ул.Котляковская",
|
||||
House = "8",
|
||||
Flat = "337"
|
||||
},
|
||||
Phone = "8 (800) 333-75-75",
|
||||
Email = "client@evoleasing.ru"
|
||||
},
|
||||
DriversCount = 0,
|
||||
FullDriversInfo = new FullDriver[]
|
||||
{
|
||||
new FullDriver
|
||||
{
|
||||
KBM="13"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
var insuranceController = new ELT.Controllers.InsuranceController();
|
||||
Dictionary<string, OSAGOFullCalculationResponse> res
|
||||
= insuranceController.CalculateOsago(request).Value;
|
||||
Assert.True(res.Count > 0);
|
||||
Assert.Equal(String.Empty, res[TARGET_INSURANCE_COMPANY].Error);
|
||||
Assert.NotEqual(0, res[TARGET_INSURANCE_COMPANY].NumCalc);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user