diff --git a/ELT.Tests/Controllers/InsuranceController/Kasko.cs b/ELT.Tests/Controllers/InsuranceController/Kasko.cs new file mode 100644 index 0000000..886028b --- /dev/null +++ b/ELT.Tests/Controllers/InsuranceController/Kasko.cs @@ -0,0 +1,215 @@ +using System; +using System.Collections.Generic; +using ELT.Client.Models.Insurance; +using ELT.Client.Models.Insurance.Request; +using ELTKasko; +using Microsoft.AspNetCore.Mvc; +using Xunit; + +namespace ELT.Tests.Controllers.InsuranceController +{ + public class Kasko + { + [Fact] + public void Test1() + { + var request = new CalculateKaskoRequest + { + CompanyIds = new[] {"INGOS"}, + Preparams = new Preparams + { + RegionName = "Рязанская обл", + CityName = "Рязань г", + BrandId = "C3B16998-C04D-484C-A17E-DB2C8FFE6DF3", + ModelId = "29DF0E37-1431-4037-AC0A-0FCA37AD0792" + }, + ELTParams = new PreliminaryKASKOCalculationParams + { + Currency = "RUR", + IsNew = true, + UsageStart = new DateTime(2021, 04, 16), + UsageCityKLADR = "6200000100000", + VehicleYear = 2021, + Mark = "AUDI", + Model = "A4", + Modification = new Modification + { + Power = 160, + KPPTypeId = 1, + BodyType = 9 + }, + BankId = "245", + Duration = 24, + Cost = 2000000, + SSType = "1", + STOA = "0", + OfficialDealer = true, + Vehicle = new VehicleParams + { + Category = "B" + }, + Drivers = new[] + { + new Driver + { + Age = 18, + Experience = 0 + } + }, + NS = new NSType + { + LimitSum = "1000000" + }, + Lessee = new PhysicalPerson + { + INN = "7727563778", + SubjectTypeSpecified = true, + SubjectType = 1 + } + } + }; + + var insuranceController = new ELT.Controllers.InsuranceController(); + Dictionary res + = insuranceController.CalculateKasko(request).Value; + Assert.True(res.Count > 0); + Assert.NotNull(res["INGOS"]); + Assert.Null(res["INGOS"].Error); + } + + [Fact] + public void Test2() + { + var request = new CalculateKaskoRequest + { + CompanyIds = new[] {"VSK"}, + Preparams = new Preparams + { + RegionName = "г.Москва", + CityName = "Москва г", + BrandId = "35CCC6D8-BE9F-49AE-983F-9DDB936A2672", + ModelId = "90642EC2-6A52-44B0-8238-3A26AFF84514" + }, + ELTParams = new PreliminaryKASKOCalculationParams + { + Currency = "RUR", + IsNew = true, + UsageStart = new DateTime(2021, 04, 16), + UsageCityKLADR = "7700000000000", + VehicleYear = 2021, + Mark = "KIA", + Model = "RIO", + Modification = new Modification + { + Power = 160, + KPPTypeId = 1, + BodyType = 9 + }, + BankId = "245", + Duration = 36, + Cost = 2000000, + SSType = "1", + STOA = "0", + OfficialDealer = true, + Vehicle = new VehicleParams + { + Category = "B", + Mileage = 50000 + }, + Drivers = new[] + { + new Driver + { + Age = 18, + Experience = 0 + } + }, + NS = new NSType + { + LimitSum = "1000000" + }, + Lessee = new PhysicalPerson + { + INN = "7727563778", + SubjectTypeSpecified = true, + SubjectType = 1 + } + } + }; + + var insuranceController = new ELT.Controllers.InsuranceController(); + Dictionary res + = insuranceController.CalculateKasko(request).Value; + Assert.True(res.Count > 0); + Assert.NotNull(res["INGOS"]); + Assert.Null(res["INGOS"].Error); + } + + [Fact] + public void Test3() + { + var request = new CalculateKaskoRequest + { + CompanyIds = new[] {"VSK"}, + Preparams = new Preparams + { + RegionName = "г.Москва", + CityName = "Москва г", + BrandId = "1204F109-AF5C-45E1-A587-0664F16AB00D", + ModelId = "78F317BB-633B-4C75-86B6-436ABE43A40E" + }, + ELTParams = new PreliminaryKASKOCalculationParams + { + Currency = "RUR", + IsNew = true, + UsageStart = new DateTime(2021, 04, 16), + UsageCityKLADR = "7700000000000", + VehicleYear = 2021, + Mark = "Jeep", + Model = "Wrangler", + Modification = new Modification + { + Power = 230, + KPPTypeId = 1, + BodyType = 9 + }, + BankId = "245", + Duration = 24, + Cost = 2000000, + SSType = "1", + STOA = "0", + OfficialDealer = true, + Vehicle = new VehicleParams + { + Category = "B" + }, + Drivers = new[] + { + new Driver + { + Age = 18, + Experience = 0 + } + }, + NS = new NSType + { + LimitSum = "1000000" + }, + Lessee = new PhysicalPerson + { + INN = "7727563778", + SubjectTypeSpecified = true, + SubjectType = 1 + } + } + }; + + var insuranceController = new ELT.Controllers.InsuranceController(); + Dictionary res + = insuranceController.CalculateKasko(request).Value; + Assert.True(res.Count > 0); + Assert.NotNull(res["INGOS"]); + Assert.Null(res["INGOS"].Error); + } + } +} \ No newline at end of file diff --git a/ELT.sln b/ELT.sln index 56909d6..6d66d4e 100644 --- a/ELT.sln +++ b/ELT.sln @@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ELT", "ELT\ELT.csproj", "{2 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ELT.Client", "ELT.Client\ELT.Client.csproj", "{9EC7C85B-FC9C-4BCE-A587-CB3B75AEE554}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ELT.Tests", "ELT.Tests\ELT.Tests.csproj", "{CADD0507-132B-4FDC-81B2-3415A372FFA3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {9EC7C85B-FC9C-4BCE-A587-CB3B75AEE554}.Debug|Any CPU.Build.0 = Debug|Any CPU {9EC7C85B-FC9C-4BCE-A587-CB3B75AEE554}.Release|Any CPU.ActiveCfg = Release|Any CPU {9EC7C85B-FC9C-4BCE-A587-CB3B75AEE554}.Release|Any CPU.Build.0 = Release|Any CPU + {CADD0507-132B-4FDC-81B2-3415A372FFA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CADD0507-132B-4FDC-81B2-3415A372FFA3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CADD0507-132B-4FDC-81B2-3415A372FFA3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CADD0507-132B-4FDC-81B2-3415A372FFA3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE