mirror of
https://github.com/KhasanovAMdev/ISTU_TEST_LR1.git
synced 2026-04-03 23:09:36 +04:00
Добавил тесты
This commit is contained in:
22
LR1/AppTesting.Tests/AppTesting.Tests.csproj
Normal file
22
LR1/AppTesting.Tests/AppTesting.Tests.csproj
Normal file
@@ -0,0 +1,22 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="xunit.v3" Version="3.2.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AppTesting\AppTesting.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
44
LR1/AppTesting.Tests/ArrayProcTests.cs
Normal file
44
LR1/AppTesting.Tests/ArrayProcTests.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using Xunit;
|
||||
|
||||
namespace AppTesting
|
||||
{
|
||||
public class ArrayProcTests
|
||||
{
|
||||
// Путь 1
|
||||
|
||||
[Fact]
|
||||
public void ArrayProc_Way_1_1()
|
||||
{
|
||||
double[] input = new double[0];
|
||||
var result = Program.ArrayProc(input);
|
||||
Assert.Null(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ArrayProc_Way_1_2()
|
||||
{
|
||||
double[] input = new double[] { 5.0 };
|
||||
var result = Program.ArrayProc(input);
|
||||
Assert.Null(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ArrayProc_Way_1_3()
|
||||
{
|
||||
double[] input = new double[] { 1.0, 2.0, 3.0, 4.0, 5.0 };
|
||||
var result = Program.ArrayProc(input);
|
||||
Assert.Null(result);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(new double[] { })]
|
||||
[InlineData(new double[] { 10.0 })]
|
||||
[InlineData(new double[] { 1.0, 2.0, 3.0 })]
|
||||
[InlineData(new double[] { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0 })]
|
||||
public void ArrayProc_Way_1_4(double[] input)
|
||||
{
|
||||
var result = Program.ArrayProc(input);
|
||||
Assert.Null(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
148
LR1/AppTesting.Tests/SearchMinValueTests.cs
Normal file
148
LR1/AppTesting.Tests/SearchMinValueTests.cs
Normal file
@@ -0,0 +1,148 @@
|
||||
using Xunit;
|
||||
|
||||
namespace AppTesting
|
||||
{
|
||||
public class SearchMinValueTests
|
||||
{
|
||||
// Путь 1
|
||||
[Fact]
|
||||
public void SearchMinValue_Way_1()
|
||||
{
|
||||
double[]? inputData = null;
|
||||
var result = Program.SearchMinValue(inputData);
|
||||
Assert.Null(result);
|
||||
}
|
||||
|
||||
// Путь 2
|
||||
[Fact]
|
||||
public void SearchMinValue_Way_2()
|
||||
{
|
||||
double[] inputData = new double[0];
|
||||
var result = Program.SearchMinValue(inputData);
|
||||
Assert.Null(result);
|
||||
}
|
||||
|
||||
// Путь 3
|
||||
[Fact]
|
||||
public void SearchMinValue_Way_3_1()
|
||||
{
|
||||
double[] inputData = new double[] { 42.5 };
|
||||
var result = Program.SearchMinValue(inputData);
|
||||
Assert.Equal(42.5, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SearchMinValue_Way_3_2()
|
||||
{
|
||||
double[] inputData = new double[] { -15.3 };
|
||||
var result = Program.SearchMinValue(inputData);
|
||||
Assert.Equal(-15.3, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SearchMinValue_Way_3_3()
|
||||
{
|
||||
double[] inputData = new double[] { 0 };
|
||||
var result = Program.SearchMinValue(inputData);
|
||||
Assert.Equal(0, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SearchMinValue_Way_3_4()
|
||||
{
|
||||
double[] inputData = new double[] { double.MaxValue };
|
||||
var result = Program.SearchMinValue(inputData);
|
||||
Assert.Equal(double.MaxValue, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SearchMinValue_Way_3_5()
|
||||
{
|
||||
double[] inputData = new double[] { double.MinValue };
|
||||
var result = Program.SearchMinValue(inputData);
|
||||
Assert.Equal(double.MinValue, result);
|
||||
}
|
||||
|
||||
// Путь 4
|
||||
[Fact]
|
||||
public void SearchMinValue_Way_4_1()
|
||||
{
|
||||
double[] inputData = new double[] { 5.0, 10.0 };
|
||||
var result = Program.SearchMinValue(inputData);
|
||||
Assert.Equal(5.0, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SearchMinValue_Way_4_2()
|
||||
{
|
||||
double[] inputData = new double[] { 7.7, 7.7 };
|
||||
var result = Program.SearchMinValue(inputData);
|
||||
Assert.Equal(7.7, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SearchMinValue_Way_4_3()
|
||||
{
|
||||
double[] inputData = new double[] { 3.0, 4.0, 5.0, 6.0, 7.0 };
|
||||
var result = Program.SearchMinValue(inputData);
|
||||
Assert.Equal(3.0, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SearchMinValue_Way_4_4()
|
||||
{
|
||||
double[] inputData = new double[] { -8.0, 2.0, 5.0 };
|
||||
var result = Program.SearchMinValue(inputData);
|
||||
Assert.Equal(-8.0, result);
|
||||
}
|
||||
|
||||
// Путь 5
|
||||
[Fact]
|
||||
public void SearchMinValue_Way_5_1()
|
||||
{
|
||||
double[] inputData = new double[] { 10.0, 5.0 };
|
||||
var result = Program.SearchMinValue(inputData);
|
||||
Assert.Equal(5.0, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SearchMinValue_Way_5_2()
|
||||
{
|
||||
double[] inputData = new double[] { 10.0, 3.0, 7.0, 9.0 };
|
||||
var result = Program.SearchMinValue(inputData);
|
||||
Assert.Equal(3.0, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SearchMinValue_Way_5_3()
|
||||
{
|
||||
double[] inputData = new double[] { 8.0, 6.0, 4.0, 2.0 };
|
||||
var result = Program.SearchMinValue(inputData);
|
||||
Assert.Equal(2.0, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SearchMinValue_Way_5_4()
|
||||
{
|
||||
double[] inputData = new double[] { 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0 };
|
||||
var result = Program.SearchMinValue(inputData);
|
||||
Assert.Equal(5.0, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SearchMinValue_Way_5_5()
|
||||
{
|
||||
double[] inputData = new double[] { 9.0, 7.0, 5.0, 3.0, -1.0 };
|
||||
var result = Program.SearchMinValue(inputData);
|
||||
Assert.Equal(-1.0, result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SearchMinValue_Way_5_6()
|
||||
{
|
||||
double[] inputData = new double[] { 5.0, -3.0, 2.0, -600.0, 7.0 };
|
||||
var result = Program.SearchMinValue(inputData);
|
||||
Assert.Equal(-600.0, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user