2021-04-20 07:11:13 +03:00

215 lines
7.4 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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<string, KASKOCalculationResult> 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<string, KASKOCalculationResult> 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<string, KASKOCalculationResult> res
= insuranceController.CalculateKasko(request).Value;
Assert.True(res.Count > 0);
Assert.NotNull(res["INGOS"]);
Assert.Null(res["INGOS"].Error);
}
}
}