fix tests

This commit is contained in:
vchikalkin 2021-04-20 11:01:30 +03:00
parent af23ef3f13
commit 547b5cd59e
5 changed files with 77 additions and 28 deletions

View File

@ -7,14 +7,4 @@ namespace ELT.Client.Managers
public string Login { get; set; }
public string Password { get; set; }
}
public class BaseManager
{
protected AuthInfo AuthInfo =>
new AuthInfo
{
Login = Environment.GetEnvironmentVariable("eltLogin"),
Password = Environment.GetEnvironmentVariable("eltPassword")
};
}
}

View File

@ -43,13 +43,13 @@ namespace ELT.Client.Managers.Insurance
, null
, null
, null
, "15"
, "13"
, null
, false
, null
, null
, kaskoParams);
if (string.IsNullOrEmpty(res.Error))
//if (string.IsNullOrEmpty(res.Error))
result.Add(companyId, res);
}));

View File

@ -3,7 +3,6 @@ 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
@ -13,9 +12,10 @@ namespace ELT.Tests.Controllers.InsuranceController
[Fact]
public void Test1()
{
var TARGET_INSURANCE_COMPANY = "INGOS";
var request = new CalculateKaskoRequest
{
CompanyIds = new[] {"INGOS"},
CompanyIds = new[] { TARGET_INSURANCE_COMPANY },
Preparams = new Preparams
{
RegionName = "Рязанская обл",
@ -48,6 +48,8 @@ namespace ELT.Tests.Controllers.InsuranceController
{
Category = "B"
},
DriversCount = 0,
Risk = 0,
Drivers = new[]
{
new Driver
@ -63,6 +65,17 @@ namespace ELT.Tests.Controllers.InsuranceController
Lessee = new PhysicalPerson
{
INN = "7727563778",
SubjectTypeSpecified = true,
SubjectType = 1
},
Owner = new PhysicalPerson
{
SubjectTypeSpecified = true,
SubjectType = 1
},
Insurer = new PhysicalPerson
{
SubjectTypeSpecified = true,
SubjectType = 1
}
@ -73,16 +86,16 @@ namespace ELT.Tests.Controllers.InsuranceController
Dictionary<string, KASKOCalculationResult> res
= insuranceController.CalculateKasko(request).Value;
Assert.True(res.Count > 0);
Assert.NotNull(res["INGOS"]);
Assert.Null(res["INGOS"].Error);
Assert.NotNull(res[TARGET_INSURANCE_COMPANY].RequestId);
}
[Fact]
public void Test2()
{
var TARGET_INSURANCE_COMPANY = "VSK";
var request = new CalculateKaskoRequest
{
CompanyIds = new[] {"VSK"},
CompanyIds = new[] { TARGET_INSURANCE_COMPANY },
Preparams = new Preparams
{
RegionName = "г.Москва",
@ -116,6 +129,8 @@ namespace ELT.Tests.Controllers.InsuranceController
Category = "B",
Mileage = 50000
},
DriversCount = 0,
Risk = 0,
Drivers = new[]
{
new Driver
@ -131,6 +146,17 @@ namespace ELT.Tests.Controllers.InsuranceController
Lessee = new PhysicalPerson
{
INN = "7727563778",
SubjectTypeSpecified = true,
SubjectType = 1
},
Owner = new PhysicalPerson
{
SubjectTypeSpecified = true,
SubjectType = 1
},
Insurer = new PhysicalPerson
{
SubjectTypeSpecified = true,
SubjectType = 1
}
@ -141,16 +167,16 @@ namespace ELT.Tests.Controllers.InsuranceController
Dictionary<string, KASKOCalculationResult> res
= insuranceController.CalculateKasko(request).Value;
Assert.True(res.Count > 0);
Assert.NotNull(res["INGOS"]);
Assert.Null(res["INGOS"].Error);
Assert.NotNull(res[TARGET_INSURANCE_COMPANY].RequestId);
}
[Fact]
public void Test3()
{
var TARGET_INSURANCE_COMPANY = "RESO_GARANTIJA";
var request = new CalculateKaskoRequest
{
CompanyIds = new[] {"VSK"},
CompanyIds = new[] { TARGET_INSURANCE_COMPANY },
Preparams = new Preparams
{
RegionName = "г.Москва",
@ -173,6 +199,7 @@ namespace ELT.Tests.Controllers.InsuranceController
KPPTypeId = 1,
BodyType = 9
},
Risk = 0,
BankId = "245",
Duration = 24,
Cost = 2000000,
@ -183,6 +210,7 @@ namespace ELT.Tests.Controllers.InsuranceController
{
Category = "B"
},
DriversCount = 0,
Drivers = new[]
{
new Driver
@ -198,6 +226,17 @@ namespace ELT.Tests.Controllers.InsuranceController
Lessee = new PhysicalPerson
{
INN = "7727563778",
SubjectTypeSpecified = true,
SubjectType = 1
},
Owner = new PhysicalPerson
{
SubjectTypeSpecified = true,
SubjectType = 1
},
Insurer = new PhysicalPerson
{
SubjectTypeSpecified = true,
SubjectType = 1
}
@ -208,8 +247,7 @@ namespace ELT.Tests.Controllers.InsuranceController
Dictionary<string, KASKOCalculationResult> res
= insuranceController.CalculateKasko(request).Value;
Assert.True(res.Count > 0);
Assert.NotNull(res["INGOS"]);
Assert.Null(res["INGOS"].Error);
Assert.NotNull(res[TARGET_INSURANCE_COMPANY].RequestId);
}
}
}

View File

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="coverlet.collector" Version="1.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ELT.Client\ELT.Client.csproj" />
<ProjectReference Include="..\ELT\ELT.csproj" />
</ItemGroup>
</Project>

12
ELT.sln
View File

@ -5,9 +5,9 @@ VisualStudioVersion = 16.0.31005.135
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ELT", "ELT\ELT.csproj", "{2DB25D88-2DC4-4923-B26D-BE9D4FE03463}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ELT.Client", "ELT.Client\ELT.Client.csproj", "{9EC7C85B-FC9C-4BCE-A587-CB3B75AEE554}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "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}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ELT.Tests", "ELT.Tests\ELT.Tests.csproj", "{F86CEFE3-5F4A-4666-94E9-2BB37C83A9CB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -23,10 +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
{F86CEFE3-5F4A-4666-94E9-2BB37C83A9CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F86CEFE3-5F4A-4666-94E9-2BB37C83A9CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F86CEFE3-5F4A-4666-94E9-2BB37C83A9CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F86CEFE3-5F4A-4666-94E9-2BB37C83A9CB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE