RED LINE UPDATE
This commit is contained in:
parent
79cdd4b5d7
commit
805a1d0322
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="8.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
|
||||||
Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
|
Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
@ -36,59 +36,71 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Castle.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
<Reference Include="Castle.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll</HintPath>
|
<HintPath>..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.DependencyInjection.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.DependencyInjection.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.Logging, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.Logging, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Extensions.Logging.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.Logging.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Extensions.Logging.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.Logging.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.Options, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.Options, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Extensions.Options.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.Options.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Extensions.Options.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.Options.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.Primitives, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.Primitives, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Extensions.Primitives.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Extensions.Primitives.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Moq, Version=4.20.72.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
<Reference Include="Moq, Version=4.20.72.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Moq.4.20.72\lib\net462\Moq.dll</HintPath>
|
<HintPath>..\packages\Moq.4.20.72\lib\net462\Moq.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="mscorlib" />
|
<Reference Include="mscorlib" />
|
||||||
|
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System"/>
|
<Reference Include="System"/>
|
||||||
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
|
<HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core"/>
|
<Reference Include="System.Core"/>
|
||||||
<Reference Include="System.Data"/>
|
<Reference Include="System.Data"/>
|
||||||
<Reference Include="System.Diagnostics.DiagnosticSource, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Diagnostics.DiagnosticSource, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.10.0.0-preview.1.25080.5\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.10.0.0-preview.1.25080.5\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.IO.Pipelines, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.IO.Pipelines.10.0.0-preview.1.25080.5\lib\net462\System.IO.Pipelines.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Memory, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Memory, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll</HintPath>
|
<HintPath>..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Numerics" />
|
<Reference Include="System.Numerics" />
|
||||||
<Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
|
<HintPath>..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Text.Encodings.Web, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Text.Encodings.Web.10.0.0-preview.1.25080.5\lib\net462\System.Text.Encodings.Web.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Text.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Text.Json.10.0.0-preview.1.25080.5\lib\net462\System.Text.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.6.0\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
|
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.6.0\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Xml"/>
|
<Reference Include="System.Xml"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@ -133,16 +145,16 @@
|
|||||||
<Compile Include="Interfaces\StoragesContracts\ISalaryStorageContact.cs" />
|
<Compile Include="Interfaces\StoragesContracts\ISalaryStorageContact.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<InternalsVisibleTo Include="CatHasPawsTests" />
|
<InternalsVisibleTo Include="CatHasPawsTests" />
|
||||||
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" />
|
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="ILLink\ILLink.Descriptors.LibraryBuild.xml" />
|
<Content Include="ILLink\ILLink.Descriptors.LibraryBuild.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text.Json;
|
||||||
using CandyHouseBase.DataModels;
|
using CandyHouseBase.DataModels;
|
||||||
using CandyHouseBase.Enums;
|
using CandyHouseBase.Exceptions;
|
||||||
|
using CandyHouseBase.Extensions;
|
||||||
using CandyHouseBase.Interfaces.BusinessLogicsContracts;
|
using CandyHouseBase.Interfaces.BusinessLogicsContracts;
|
||||||
using CandyHouseBase.Interfaces.StoragesContracts;
|
using CandyHouseBase.Interfaces.StoragesContracts;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
@ -12,31 +14,31 @@ namespace CandyHouseBase.Implementations
|
|||||||
ISalaryStorageContact salaryStorageContact,
|
ISalaryStorageContact salaryStorageContact,
|
||||||
IPekarStorageContact pekarStorageContact,
|
IPekarStorageContact pekarStorageContact,
|
||||||
ILogger logger)
|
ILogger logger)
|
||||||
: ISalaryStorageContact
|
: ISalaryBusinessLogicContact
|
||||||
{
|
{
|
||||||
private readonly ISalaryStorageContact _salaryStorageContact = salaryStorageContact;
|
private readonly ISalaryStorageContact _salaryStorageContact = salaryStorageContact;
|
||||||
private readonly IPekarStorageContact _pekarStorageContact = pekarStorageContact;
|
private readonly IPekarStorageContact _pekarStorageContact = pekarStorageContact;
|
||||||
private readonly ILogger _logger = logger;
|
private readonly ILogger _logger = logger;
|
||||||
|
|
||||||
public List<SalaryDataModel> GetList()
|
public List<SalaryDataModel> GetAllSalaries()
|
||||||
{
|
{
|
||||||
return new List<SalaryDataModel>();
|
return new List<SalaryDataModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SalaryDataModel GetElementById(string id)
|
public SalaryDataModel GetSalaryByData(string data)
|
||||||
{
|
{
|
||||||
return new SalaryDataModel("", "", new DateTime(), 0, 0, 0);
|
return new SalaryDataModel("", "", new DateTime(), 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddElement(SalaryDataModel element)
|
public void InsertSalary(SalaryDataModel salary)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateElement(SalaryDataModel element)
|
public void UpdateSalary(SalaryDataModel salary)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteElement(string id)
|
public void DeleteSalary(string id)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,6 @@ namespace CandyHouseBase.Interfaces.StoragesContracts
|
|||||||
void AddElement(OrderDataModel order);
|
void AddElement(OrderDataModel order);
|
||||||
void UpdateElement(OrderDataModel order);
|
void UpdateElement(OrderDataModel order);
|
||||||
void DeleteElement(OrderDataModel order);
|
void DeleteElement(OrderDataModel order);
|
||||||
OrderDataModel GetElementById(int orderId);
|
OrderDataModel GetElementById(string orderId);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,11 +2,14 @@ using Moq;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using CandyHouseBase.DataModels;
|
using CandyHouseBase.DataModels;
|
||||||
using CandyHouseBase.Exceptions;
|
using CandyHouseBase.Exceptions;
|
||||||
|
using CandyHouseBase.Extensions;
|
||||||
|
using CandyHouseBase.Implementations;
|
||||||
|
using CandyHouseBase.Interfaces.BusinessLogicsContracts;
|
||||||
using CandyHouseBase.Interfaces.StoragesContracts;
|
using CandyHouseBase.Interfaces.StoragesContracts;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using CandyHouseBase.Implementations;
|
|
||||||
|
|
||||||
namespace CandyHouseTests.BusinessLogicsContractsTests
|
namespace CandyHouseTests.BusinessLogicsContractsTests
|
||||||
{
|
{
|
||||||
@ -20,8 +23,10 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void OneTimeSetUp()
|
public void OneTimeSetUp()
|
||||||
{
|
{
|
||||||
_ingredientStorageContact = new Mock<IIngredientStorageContact>();
|
_ingredientStorageContact = new Mock<IIngredientStorageContact>();
|
||||||
_ingredientBusinessLogicContract =
|
_ingredientBusinessLogicContract = new IngredientBusinessLogicContract(
|
||||||
new IngredientBusinessLogicContract(_ingredientStorageContact.Object, new Mock<ILogger>().Object);
|
_ingredientStorageContact.Object,
|
||||||
|
new Mock<ILogger>().Object
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
@ -36,9 +41,9 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
// Arrange
|
// Arrange
|
||||||
var ingredients = new List<IngredientDataModel>
|
var ingredients = new List<IngredientDataModel>
|
||||||
{
|
{
|
||||||
new(Guid.NewGuid().ToString(), "Sugar", "kg", 100),
|
new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100),
|
||||||
new(Guid.NewGuid().ToString(), "Flour", "kg", 200),
|
new IngredientDataModel(Guid.NewGuid().ToString(), "Flour", "kg", 200),
|
||||||
new(Guid.NewGuid().ToString(), "Cocoa", "kg", 50)
|
new IngredientDataModel(Guid.NewGuid().ToString(), "Cocoa", "kg", 50)
|
||||||
};
|
};
|
||||||
_ingredientStorageContact.Setup(x => x.GetList()).Returns(ingredients);
|
_ingredientStorageContact.Setup(x => x.GetList()).Returns(ingredients);
|
||||||
|
|
||||||
@ -48,6 +53,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
// Assert
|
// Assert
|
||||||
Assert.That(list, Is.Not.Null);
|
Assert.That(list, Is.Not.Null);
|
||||||
Assert.That(list, Is.EquivalentTo(ingredients));
|
Assert.That(list, Is.EquivalentTo(ingredients));
|
||||||
|
Assert.That(list.All(i => Guid.TryParse(i.Id, out _) && !i.Name.IsEmpty() && !i.Unit.IsEmpty() && i.Cost >= 0), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -80,8 +86,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void GetAllIngredients_StorageThrowError_ThrowException_Test()
|
public void GetAllIngredients_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_ingredientStorageContact.Setup(x => x.GetList())
|
_ingredientStorageContact.Setup(x => x.GetList()).Throws(new StorageException(new InvalidOperationException()));
|
||||||
.Throws(new StorageException(new InvalidOperationException()));
|
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _ingredientBusinessLogicContract.GetAllIngredients(), Throws.TypeOf<StorageException>());
|
Assert.That(() => _ingredientBusinessLogicContract.GetAllIngredients(), Throws.TypeOf<StorageException>());
|
||||||
@ -89,7 +94,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetIngredientById_ReturnsRecord_Test()
|
public void GetIngredientByData_ReturnsIngredientById_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var id = Guid.NewGuid().ToString();
|
var id = Guid.NewGuid().ToString();
|
||||||
@ -102,11 +107,15 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
// Assert
|
// Assert
|
||||||
Assert.That(element, Is.Not.Null);
|
Assert.That(element, Is.Not.Null);
|
||||||
Assert.That(element.Id, Is.EqualTo(id));
|
Assert.That(element.Id, Is.EqualTo(id));
|
||||||
|
Assert.That(Guid.TryParse(element.Id, out _), Is.True);
|
||||||
|
Assert.That(!element.Name.IsEmpty());
|
||||||
|
Assert.That(!element.Unit.IsEmpty());
|
||||||
|
Assert.That(element.Cost >= 0);
|
||||||
_ingredientStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
_ingredientStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetIngredientByName_ReturnsRecord_Test()
|
public void GetIngredientByData_ReturnsIngredientByName_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var name = "Sugar";
|
var name = "Sugar";
|
||||||
@ -119,175 +128,148 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
// Assert
|
// Assert
|
||||||
Assert.That(element, Is.Not.Null);
|
Assert.That(element, Is.Not.Null);
|
||||||
Assert.That(element.Name, Is.EqualTo(name));
|
Assert.That(element.Name, Is.EqualTo(name));
|
||||||
|
Assert.That(Guid.TryParse(element.Id, out _), Is.True);
|
||||||
|
Assert.That(!element.Unit.IsEmpty());
|
||||||
|
Assert.That(element.Cost >= 0);
|
||||||
_ingredientStorageContact.Verify(x => x.GetElementByName(It.IsAny<string>()), Times.Once);
|
_ingredientStorageContact.Verify(x => x.GetElementByName(It.IsAny<string>()), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetIngredientById_NotFoundRecord_ThrowException_Test()
|
public void GetIngredientByData_EmptyData_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
|
||||||
var id = "nonexistent";
|
|
||||||
_ingredientStorageContact.Setup(x => x.GetElementById(id)).Returns((IngredientDataModel)null);
|
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _ingredientBusinessLogicContract.GetIngredientByData(id),
|
Assert.That(() => _ingredientBusinessLogicContract.GetIngredientByData(null), Throws.TypeOf<ArgumentNullException>());
|
||||||
Throws.TypeOf<ElementNotFoundException>());
|
Assert.That(() => _ingredientBusinessLogicContract.GetIngredientByData(string.Empty), Throws.TypeOf<ArgumentNullException>());
|
||||||
_ingredientStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
_ingredientStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Never);
|
||||||
|
_ingredientStorageContact.Verify(x => x.GetElementByName(It.IsAny<string>()), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetIngredientByName_NotFoundRecord_ThrowException_Test()
|
public void GetIngredientByData_NotFoundById_ThrowException_Test()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var id = Guid.NewGuid().ToString(); // Valid Guid
|
||||||
|
_ingredientStorageContact.Setup(x => x.GetElementById(id)).Returns((IngredientDataModel)null);
|
||||||
|
|
||||||
|
// Act & Assert
|
||||||
|
Assert.That(() => _ingredientBusinessLogicContract.GetIngredientByData(id), Throws.TypeOf<ElementNotFoundException>());
|
||||||
|
_ingredientStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetIngredientByData_NotFoundByName_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var name = "Nonexistent";
|
var name = "Nonexistent";
|
||||||
_ingredientStorageContact.Setup(x => x.GetElementByName(name)).Returns((IngredientDataModel)null);
|
_ingredientStorageContact.Setup(x => x.GetElementByName(name)).Returns((IngredientDataModel)null);
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _ingredientBusinessLogicContract.GetIngredientByData(name),
|
Assert.That(() => _ingredientBusinessLogicContract.GetIngredientByData(name), Throws.TypeOf<ElementNotFoundException>());
|
||||||
Throws.TypeOf<ElementNotFoundException>());
|
_ingredientStorageContact.Verify(x => x.GetElementByName(name), Times.Once);
|
||||||
_ingredientStorageContact.Verify(x => x.GetElementByName(It.IsAny<string>()), Times.Once);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetIngredientById_StorageThrowError_ThrowException_Test()
|
public void GetIngredientByData_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_ingredientStorageContact.Setup(x => x.GetElementById(It.IsAny<string>()))
|
_ingredientStorageContact.Setup(x => x.GetElementById(It.IsAny<string>())).Throws(new StorageException(new InvalidOperationException()));
|
||||||
.Throws(new StorageException(new InvalidOperationException()));
|
_ingredientStorageContact.Setup(x => x.GetElementByName(It.IsAny<string>())).Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _ingredientBusinessLogicContract.GetIngredientByData(Guid.NewGuid().ToString()),
|
Assert.That(() => _ingredientBusinessLogicContract.GetIngredientByData(Guid.NewGuid().ToString()), Throws.TypeOf<StorageException>());
|
||||||
Throws.TypeOf<StorageException>());
|
Assert.That(() => _ingredientBusinessLogicContract.GetIngredientByData("Sugar"), Throws.TypeOf<StorageException>());
|
||||||
_ingredientStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
_ingredientStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void GetIngredientByName_StorageThrowError_ThrowException_Test()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
_ingredientStorageContact.Setup(x => x.GetElementByName(It.IsAny<string>()))
|
|
||||||
.Throws(new StorageException(new InvalidOperationException()));
|
|
||||||
|
|
||||||
// Act & Assert
|
|
||||||
Assert.That(() => _ingredientBusinessLogicContract.GetIngredientByData("Sugar"),
|
|
||||||
Throws.TypeOf<StorageException>());
|
|
||||||
_ingredientStorageContact.Verify(x => x.GetElementByName(It.IsAny<string>()), Times.Once);
|
_ingredientStorageContact.Verify(x => x.GetElementByName(It.IsAny<string>()), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void AddIngredient_CorrectRecord_Test()
|
public void InsertIngredient_CorrectRecord_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var flag = false;
|
|
||||||
var ingredient = new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100);
|
var ingredient = new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100);
|
||||||
_ingredientStorageContact.Setup(x => x.AddElement(It.IsAny<IngredientDataModel>()))
|
_ingredientStorageContact.Setup(x => x.AddElement(ingredient)).Verifiable();
|
||||||
.Callback((IngredientDataModel x) =>
|
|
||||||
{
|
|
||||||
flag = x.Id == ingredient.Id && x.Name == ingredient.Name &&
|
|
||||||
x.Cost == ingredient.Cost && x.Unit == ingredient.Unit;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
_ingredientBusinessLogicContract.InsertIngredient(ingredient);
|
_ingredientBusinessLogicContract.InsertIngredient(ingredient);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
_ingredientStorageContact.Verify(x => x.AddElement(It.IsAny<IngredientDataModel>()), Times.Once);
|
_ingredientStorageContact.Verify(x => x.AddElement(ingredient), Times.Once);
|
||||||
Assert.That(flag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void AddIngredient_RecordWithExistsData_ThrowException_Test()
|
public void InsertIngredient_RecordWithExistsData_ThrowException_Test()
|
||||||
{
|
{
|
||||||
var ingredient = It.IsAny<IngredientDataModel>();
|
|
||||||
// Arrange
|
// Arrange
|
||||||
|
var ingredient = new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100);
|
||||||
_ingredientStorageContact.Setup(x => x.AddElement(ingredient))
|
_ingredientStorageContact.Setup(x => x.AddElement(ingredient))
|
||||||
.Throws(new ElementExistsException("ID", ingredient.Id));
|
.Throws(new ElementExistsException("ID", ingredient.Id));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(
|
Assert.That(() => _ingredientBusinessLogicContract.InsertIngredient(ingredient), Throws.TypeOf<ElementExistsException>());
|
||||||
() => _ingredientBusinessLogicContract.InsertIngredient(
|
_ingredientStorageContact.Verify(x => x.AddElement(ingredient), Times.Once);
|
||||||
new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100)),
|
|
||||||
Throws.TypeOf<ElementExistsException>());
|
|
||||||
_ingredientStorageContact.Verify(x => x.AddElement(It.IsAny<IngredientDataModel>()), Times.Once);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void AddIngredient_NullRecord_ThrowException_Test()
|
public void InsertIngredient_NullRecord_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _ingredientBusinessLogicContract.InsertIngredient(null),
|
Assert.That(() => _ingredientBusinessLogicContract.InsertIngredient(null), Throws.TypeOf<ArgumentNullException>());
|
||||||
Throws.TypeOf<ArgumentNullException>());
|
|
||||||
_ingredientStorageContact.Verify(x => x.AddElement(It.IsAny<IngredientDataModel>()), Times.Never);
|
_ingredientStorageContact.Verify(x => x.AddElement(It.IsAny<IngredientDataModel>()), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void AddIngredient_InvalidRecord_ThrowException_Test()
|
public void InsertIngredient_InvalidRecord_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(
|
Assert.That(() => _ingredientBusinessLogicContract.InsertIngredient(new IngredientDataModel("", "", "", -1)), Throws.TypeOf<ValidationException>());
|
||||||
() => _ingredientBusinessLogicContract.InsertIngredient(new IngredientDataModel("", null, "", -1)),
|
|
||||||
Throws.TypeOf<ValidationException>());
|
|
||||||
_ingredientStorageContact.Verify(x => x.AddElement(It.IsAny<IngredientDataModel>()), Times.Never);
|
_ingredientStorageContact.Verify(x => x.AddElement(It.IsAny<IngredientDataModel>()), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void AddIngredient_StorageThrowError_ThrowException_Test()
|
public void InsertIngredient_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_ingredientStorageContact.Setup(x => x.AddElement(It.IsAny<IngredientDataModel>()))
|
var ingredient = new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100);
|
||||||
|
_ingredientStorageContact.Setup(x => x.AddElement(ingredient))
|
||||||
.Throws(new StorageException(new InvalidOperationException()));
|
.Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(
|
Assert.That(() => _ingredientBusinessLogicContract.InsertIngredient(ingredient), Throws.TypeOf<StorageException>());
|
||||||
() => _ingredientBusinessLogicContract.InsertIngredient(
|
_ingredientStorageContact.Verify(x => x.AddElement(ingredient), Times.Once);
|
||||||
new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100)),
|
|
||||||
Throws.TypeOf<StorageException>());
|
|
||||||
_ingredientStorageContact.Verify(x => x.AddElement(It.IsAny<IngredientDataModel>()), Times.Once);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void UpdateIngredient_CorrectRecord_Test()
|
public void UpdateIngredient_CorrectRecord_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var flag = false;
|
|
||||||
var ingredient = new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100);
|
var ingredient = new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100);
|
||||||
_ingredientStorageContact.Setup(x => x.UpdateElement(It.IsAny<IngredientDataModel>()))
|
_ingredientStorageContact.Setup(x => x.UpdateElement(ingredient)).Verifiable();
|
||||||
.Callback((IngredientDataModel x) =>
|
|
||||||
{
|
|
||||||
flag = x.Id == ingredient.Id && x.Name == ingredient.Name &&
|
|
||||||
x.Cost == ingredient.Cost && x.Unit == ingredient.Unit;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
_ingredientBusinessLogicContract.UpdateIngredient(ingredient);
|
_ingredientBusinessLogicContract.UpdateIngredient(ingredient);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
_ingredientStorageContact.Verify(x => x.UpdateElement(It.IsAny<IngredientDataModel>()), Times.Once);
|
_ingredientStorageContact.Verify(x => x.UpdateElement(ingredient), Times.Once);
|
||||||
Assert.That(flag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void UpdateIngredient_RecordNotFound_ThrowException_Test()
|
public void UpdateIngredient_RecordNotFound_ThrowException_Test()
|
||||||
{
|
{
|
||||||
var ingredient = It.IsAny<IngredientDataModel>();
|
|
||||||
// Arrange
|
// Arrange
|
||||||
|
var ingredient = new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100);
|
||||||
_ingredientStorageContact.Setup(x => x.UpdateElement(ingredient))
|
_ingredientStorageContact.Setup(x => x.UpdateElement(ingredient))
|
||||||
.Throws(new ElementNotFoundException(ingredient.ToString()));
|
.Throws(new ElementNotFoundException(ingredient.Id));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(
|
Assert.That(() => _ingredientBusinessLogicContract.UpdateIngredient(ingredient), Throws.TypeOf<ElementNotFoundException>());
|
||||||
() => _ingredientBusinessLogicContract.UpdateIngredient(
|
_ingredientStorageContact.Verify(x => x.UpdateElement(ingredient), Times.Once);
|
||||||
new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100)),
|
|
||||||
Throws.TypeOf<ElementNotFoundException>());
|
|
||||||
_ingredientStorageContact.Verify(x => x.UpdateElement(It.IsAny<IngredientDataModel>()), Times.Once);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void UpdateIngredient_NullRecord_ThrowException_Test()
|
public void UpdateIngredient_NullRecord_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _ingredientBusinessLogicContract.UpdateIngredient(null),
|
Assert.That(() => _ingredientBusinessLogicContract.UpdateIngredient(null), Throws.TypeOf<ArgumentNullException>());
|
||||||
Throws.TypeOf<ArgumentNullException>());
|
|
||||||
_ingredientStorageContact.Verify(x => x.UpdateElement(It.IsAny<IngredientDataModel>()), Times.Never);
|
_ingredientStorageContact.Verify(x => x.UpdateElement(It.IsAny<IngredientDataModel>()), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,9 +277,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void UpdateIngredient_InvalidRecord_ThrowException_Test()
|
public void UpdateIngredient_InvalidRecord_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(
|
Assert.That(() => _ingredientBusinessLogicContract.UpdateIngredient(new IngredientDataModel("", "", "", -1)), Throws.TypeOf<ValidationException>());
|
||||||
() => _ingredientBusinessLogicContract.UpdateIngredient(new IngredientDataModel("", null, "", -1)),
|
|
||||||
Throws.TypeOf<ValidationException>());
|
|
||||||
_ingredientStorageContact.Verify(x => x.UpdateElement(It.IsAny<IngredientDataModel>()), Times.Never);
|
_ingredientStorageContact.Verify(x => x.UpdateElement(It.IsAny<IngredientDataModel>()), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,56 +285,69 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void UpdateIngredient_StorageThrowError_ThrowException_Test()
|
public void UpdateIngredient_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_ingredientStorageContact.Setup(x => x.UpdateElement(It.IsAny<IngredientDataModel>()))
|
var ingredient = new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100);
|
||||||
|
_ingredientStorageContact.Setup(x => x.UpdateElement(ingredient))
|
||||||
.Throws(new StorageException(new InvalidOperationException()));
|
.Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(
|
Assert.That(() => _ingredientBusinessLogicContract.UpdateIngredient(ingredient), Throws.TypeOf<StorageException>());
|
||||||
() => _ingredientBusinessLogicContract.UpdateIngredient(
|
_ingredientStorageContact.Verify(x => x.UpdateElement(ingredient), Times.Once);
|
||||||
new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100)),
|
|
||||||
Throws.TypeOf<StorageException>());
|
|
||||||
_ingredientStorageContact.Verify(x => x.UpdateElement(It.IsAny<IngredientDataModel>()), Times.Once);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DeleteIngredient_CorrectId_Test()
|
public void DeleteIngredient_CorrectId_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var id = "1";
|
var id = Guid.NewGuid().ToString();
|
||||||
|
var ingredient = new IngredientDataModel(id, "Sugar", "kg", 100);
|
||||||
var flag = false;
|
var flag = false;
|
||||||
_ingredientStorageContact.Setup(x => x.DeleteElement(It.Is((string x) => x == id)))
|
_ingredientStorageContact.Setup(x => x.GetElementById(id)).Returns(ingredient);
|
||||||
.Callback(() => { flag = true; });
|
_ingredientStorageContact.Setup(x => x.DeleteElement(id)).Callback(() => { flag = true; });
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
_ingredientBusinessLogicContract.DeleteIngredient(id);
|
_ingredientBusinessLogicContract.DeleteIngredient(id);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
_ingredientStorageContact.Verify(x => x.DeleteElement(It.IsAny<string>()), Times.Once);
|
_ingredientStorageContact.Verify(x => x.DeleteElement(id), Times.Once);
|
||||||
Assert.That(flag);
|
Assert.That(flag);
|
||||||
|
Assert.That(Guid.TryParse(ingredient.Id, out _), Is.True);
|
||||||
|
Assert.That(!ingredient.Name.IsEmpty());
|
||||||
|
Assert.That(!ingredient.Unit.IsEmpty());
|
||||||
|
Assert.That(ingredient.Cost >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DeleteIngredient_RecordNotFound_ThrowException_Test()
|
public void DeleteIngredient_RecordNotFound_ThrowException_Test()
|
||||||
{
|
{
|
||||||
var ingredient = It.IsAny<IngredientDataModel>();
|
|
||||||
// Arrange
|
// Arrange
|
||||||
_ingredientStorageContact.Setup(x => x.UpdateElement(ingredient))
|
var id = Guid.NewGuid().ToString(); // Use valid Guid
|
||||||
.Throws(new ElementNotFoundException(ingredient.ToString()));
|
_ingredientStorageContact.Setup(x => x.GetElementById(id)).Returns((IngredientDataModel)null);
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _ingredientBusinessLogicContract.DeleteIngredient("nonexistent"),
|
Assert.That(() => _ingredientBusinessLogicContract.DeleteIngredient(id), Throws.TypeOf<ElementNotFoundException>());
|
||||||
Throws.TypeOf<ElementNotFoundException>());
|
_ingredientStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
_ingredientStorageContact.Verify(x => x.DeleteElement(It.IsAny<string>()), Times.Once);
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void DeleteIngredient_StorageThrowError_ThrowException_Test()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var id = Guid.NewGuid().ToString();
|
||||||
|
_ingredientStorageContact.Setup(x => x.GetElementById(id)).Returns(new IngredientDataModel(id, "Sugar", "kg", 100));
|
||||||
|
_ingredientStorageContact.Setup(x => x.DeleteElement(id)).Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
|
||||||
|
// Act & Assert
|
||||||
|
Assert.That(() => _ingredientBusinessLogicContract.DeleteIngredient(id), Throws.TypeOf<StorageException>());
|
||||||
|
_ingredientStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
|
_ingredientStorageContact.Verify(x => x.DeleteElement(id), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DeleteIngredient_NullOrEmptyId_ThrowException_Test()
|
public void DeleteIngredient_NullOrEmptyId_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _ingredientBusinessLogicContract.DeleteIngredient(null),
|
Assert.That(() => _ingredientBusinessLogicContract.DeleteIngredient(null), Throws.TypeOf<ArgumentNullException>());
|
||||||
Throws.TypeOf<ArgumentNullException>());
|
Assert.That(() => _ingredientBusinessLogicContract.DeleteIngredient(string.Empty), Throws.TypeOf<ArgumentNullException>());
|
||||||
Assert.That(() => _ingredientBusinessLogicContract.DeleteIngredient(string.Empty),
|
|
||||||
Throws.TypeOf<ArgumentNullException>());
|
|
||||||
_ingredientStorageContact.Verify(x => x.DeleteElement(It.IsAny<string>()), Times.Never);
|
_ingredientStorageContact.Verify(x => x.DeleteElement(It.IsAny<string>()), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,22 +355,8 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void DeleteIngredient_InvalidId_ThrowException_Test()
|
public void DeleteIngredient_InvalidId_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _ingredientBusinessLogicContract.DeleteIngredient("invalid"),
|
Assert.That(() => _ingredientBusinessLogicContract.DeleteIngredient("invalid"), Throws.TypeOf<ValidationException>());
|
||||||
Throws.TypeOf<ValidationException>());
|
|
||||||
_ingredientStorageContact.Verify(x => x.DeleteElement(It.IsAny<string>()), Times.Never);
|
_ingredientStorageContact.Verify(x => x.DeleteElement(It.IsAny<string>()), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void DeleteIngredient_StorageThrowError_ThrowException_Test()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
_ingredientStorageContact.Setup(x => x.DeleteElement(It.IsAny<string>()))
|
|
||||||
.Throws(new StorageException(new InvalidOperationException()));
|
|
||||||
|
|
||||||
// Act & Assert
|
|
||||||
Assert.That(() => _ingredientBusinessLogicContract.DeleteIngredient(Guid.NewGuid().ToString()),
|
|
||||||
Throws.TypeOf<StorageException>());
|
|
||||||
_ingredientStorageContact.Verify(x => x.DeleteElement(It.IsAny<string>()), Times.Once);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using CandyHouseBase.DataModels;
|
using CandyHouseBase.DataModels;
|
||||||
using CandyHouseBase.Enums;
|
using CandyHouseBase.Enums;
|
||||||
using CandyHouseBase.Exceptions;
|
using CandyHouseBase.Exceptions;
|
||||||
|
using CandyHouseBase.Extensions;
|
||||||
using CandyHouseBase.Implementations;
|
using CandyHouseBase.Implementations;
|
||||||
using CandyHouseBase.Interfaces.BusinessLogicsContracts;
|
using CandyHouseBase.Interfaces.BusinessLogicsContracts;
|
||||||
using CandyHouseBase.Interfaces.StoragesContracts;
|
using CandyHouseBase.Interfaces.StoragesContracts;
|
||||||
@ -138,7 +139,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
Guid.NewGuid().ToString(),
|
Guid.NewGuid().ToString(),
|
||||||
StatusType.Pending
|
StatusType.Pending
|
||||||
);
|
);
|
||||||
_orderStorageContact.Setup(x => x.GetElementById(It.Is<int>(i => i.ToString() == id))).Returns(order);
|
_orderStorageContact.Setup(x => x.GetElementById(id)).Returns(order);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var element = _orderBusinessLogicContract.GetOrderByData(id);
|
var element = _orderBusinessLogicContract.GetOrderByData(id);
|
||||||
@ -146,7 +147,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
// Assert
|
// Assert
|
||||||
Assert.That(element, Is.Not.Null);
|
Assert.That(element, Is.Not.Null);
|
||||||
Assert.That(element.Id, Is.EqualTo(id));
|
Assert.That(element.Id, Is.EqualTo(id));
|
||||||
_orderStorageContact.Verify(x => x.GetElementById(It.Is<int>(i => i.ToString() == id)), Times.Once);
|
_orderStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -154,35 +155,32 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
{
|
{
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _orderBusinessLogicContract.GetOrderByData(null), Throws.TypeOf<ArgumentNullException>());
|
Assert.That(() => _orderBusinessLogicContract.GetOrderByData(null), Throws.TypeOf<ArgumentNullException>());
|
||||||
Assert.That(() => _orderBusinessLogicContract.GetOrderByData(string.Empty),
|
Assert.That(() => _orderBusinessLogicContract.GetOrderByData(string.Empty), Throws.TypeOf<ArgumentNullException>());
|
||||||
Throws.TypeOf<ArgumentNullException>());
|
_orderStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Never);
|
||||||
_orderStorageContact.Verify(x => x.GetElementById(It.IsAny<int>()), Times.Never);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetOrderByData_NotFoundRecord_ThrowException_Test()
|
public void GetOrderByData_NotFoundRecord_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var id = "999";
|
var id = Guid.NewGuid().ToString();
|
||||||
_orderStorageContact.Setup(x => x.GetElementById(It.Is<int>(i => i.ToString() == id)))
|
_orderStorageContact.Setup(x => x.GetElementById(id)).Returns((OrderDataModel)null);
|
||||||
.Returns((OrderDataModel)null);
|
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _orderBusinessLogicContract.GetOrderByData(id),
|
Assert.That(() => _orderBusinessLogicContract.GetOrderByData(id), Throws.TypeOf<ElementNotFoundException>());
|
||||||
Throws.TypeOf<ElementNotFoundException>());
|
_orderStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
_orderStorageContact.Verify(x => x.GetElementById(It.Is<int>(i => i.ToString() == id)), Times.Once);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetOrderByData_StorageThrowError_ThrowException_Test()
|
public void GetOrderByData_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_orderStorageContact.Setup(x => x.GetElementById(It.IsAny<int>()))
|
_orderStorageContact.Setup(x => x.GetElementById(It.IsAny<string>()))
|
||||||
.Throws(new StorageException(new InvalidOperationException()));
|
.Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _orderBusinessLogicContract.GetOrderByData("1"), Throws.TypeOf<StorageException>());
|
Assert.That(() => _orderBusinessLogicContract.GetOrderByData(Guid.NewGuid().ToString()), Throws.TypeOf<StorageException>());
|
||||||
_orderStorageContact.Verify(x => x.GetElementById(It.IsAny<int>()), Times.Once);
|
_orderStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -202,14 +200,16 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
pekarId,
|
pekarId,
|
||||||
StatusType.Pending
|
StatusType.Pending
|
||||||
);
|
);
|
||||||
_orderStorageContact.Setup(x => x.AddElement(It.IsAny<OrderDataModel>()))
|
_orderStorageContact.Setup(x => x.GetElementById(order.Id)).Returns((OrderDataModel)null); // No existing order
|
||||||
|
_orderStorageContact.Setup(x => x.AddElement(It.Is<OrderDataModel>(o => o.Id == order.Id)))
|
||||||
.Callback((OrderDataModel x) =>
|
.Callback((OrderDataModel x) =>
|
||||||
{
|
{
|
||||||
flag = x.Id == order.Id && x.CustomerName == order.CustomerName && x.OrderDate == order.OrderDate &&
|
flag = x.Id == order.Id && x.CustomerName == order.CustomerName && x.OrderDate == order.OrderDate &&
|
||||||
x.TotalAmount == order.TotalAmount && x.DiscountAmount == order.DiscountAmount &&
|
x.TotalAmount == order.TotalAmount && x.DiscountAmount == order.DiscountAmount &&
|
||||||
x.ProductId == order.ProductId && x.PekarId == order.PekarId &&
|
x.ProductId == order.ProductId && x.PekarId == order.PekarId &&
|
||||||
x.StatusType == order.StatusType;
|
x.StatusType == order.StatusType;
|
||||||
});
|
})
|
||||||
|
.Verifiable();
|
||||||
_pekarStorageContact.Setup(x => x.GetElementById(pekarId))
|
_pekarStorageContact.Setup(x => x.GetElementById(pekarId))
|
||||||
.Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
.Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
||||||
_productStorageContact.Setup(x => x.GetElementById(productId))
|
_productStorageContact.Setup(x => x.GetElementById(productId))
|
||||||
@ -219,7 +219,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
_orderBusinessLogicContract.InsertOrder(order);
|
_orderBusinessLogicContract.InsertOrder(order);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
_orderStorageContact.Verify(x => x.AddElement(It.IsAny<OrderDataModel>()), Times.Once);
|
_orderStorageContact.Verify(x => x.AddElement(It.Is<OrderDataModel>(o => o.Id == order.Id)), Times.Once);
|
||||||
Assert.That(flag);
|
Assert.That(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,22 +227,27 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void InsertOrder_RecordWithExistsData_ThrowException_Test()
|
public void InsertOrder_RecordWithExistsData_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
|
var pekarId = Guid.NewGuid().ToString();
|
||||||
|
var productId = Guid.NewGuid().ToString();
|
||||||
var order = new OrderDataModel(
|
var order = new OrderDataModel(
|
||||||
Guid.NewGuid().ToString(),
|
Guid.NewGuid().ToString(),
|
||||||
"John Doe",
|
"John Doe",
|
||||||
DateTime.Now,
|
DateTime.Now,
|
||||||
100.50m,
|
100.50m,
|
||||||
10.50m,
|
10.50m,
|
||||||
Guid.NewGuid().ToString(),
|
productId,
|
||||||
Guid.NewGuid().ToString(),
|
pekarId,
|
||||||
StatusType.Pending
|
StatusType.Pending
|
||||||
);
|
);
|
||||||
_orderStorageContact.Setup(x => x.AddElement(It.IsAny<OrderDataModel>()))
|
_orderStorageContact.Setup(x => x.GetElementById(order.Id)).Returns(order); // Existing order
|
||||||
.Throws(new ElementExistsException("ID", order.Id));
|
_pekarStorageContact.Setup(x => x.GetElementById(pekarId))
|
||||||
|
.Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
||||||
|
_productStorageContact.Setup(x => x.GetElementById(productId))
|
||||||
|
.Returns(new ProductDataModel(productId, "Cake", "Super soft cake", new List<IngredientDataModel>()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _orderBusinessLogicContract.InsertOrder(order), Throws.TypeOf<ElementExistsException>());
|
Assert.That(() => _orderBusinessLogicContract.InsertOrder(order), Throws.TypeOf<ElementExistsException>());
|
||||||
_orderStorageContact.Verify(x => x.AddElement(It.IsAny<OrderDataModel>()), Times.Once);
|
_orderStorageContact.Verify(x => x.GetElementById(order.Id), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -274,22 +279,30 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void InsertOrder_StorageThrowError_ThrowException_Test()
|
public void InsertOrder_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
|
var pekarId = Guid.NewGuid().ToString();
|
||||||
|
var productId = Guid.NewGuid().ToString();
|
||||||
var order = new OrderDataModel(
|
var order = new OrderDataModel(
|
||||||
Guid.NewGuid().ToString(),
|
Guid.NewGuid().ToString(),
|
||||||
"John Doe",
|
"John Doe",
|
||||||
DateTime.Now,
|
DateTime.Now,
|
||||||
100.50m,
|
100.50m,
|
||||||
10.50m,
|
10.50m,
|
||||||
Guid.NewGuid().ToString(),
|
productId,
|
||||||
Guid.NewGuid().ToString(),
|
pekarId,
|
||||||
StatusType.Pending
|
StatusType.Pending
|
||||||
);
|
);
|
||||||
_orderStorageContact.Setup(x => x.AddElement(It.IsAny<OrderDataModel>()))
|
_orderStorageContact.Setup(x => x.GetElementById(order.Id)).Returns((OrderDataModel)null); // No existing order
|
||||||
|
_pekarStorageContact.Setup(x => x.GetElementById(pekarId))
|
||||||
|
.Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
||||||
|
_productStorageContact.Setup(x => x.GetElementById(productId))
|
||||||
|
.Returns(new ProductDataModel(productId, "Cake", "Super soft cake", new List<IngredientDataModel>()));
|
||||||
|
_orderStorageContact.Setup(x => x.AddElement(It.Is<OrderDataModel>(o => o.Id == order.Id)))
|
||||||
.Throws(new StorageException(new InvalidOperationException()));
|
.Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _orderBusinessLogicContract.InsertOrder(order), Throws.TypeOf<StorageException>());
|
Assert.That(() => _orderBusinessLogicContract.InsertOrder(order), Throws.TypeOf<StorageException>());
|
||||||
_orderStorageContact.Verify(x => x.AddElement(It.IsAny<OrderDataModel>()), Times.Once);
|
_orderStorageContact.Verify(x => x.GetElementById(order.Id), Times.Once);
|
||||||
|
_orderStorageContact.Verify(x => x.AddElement(It.Is<OrderDataModel>(o => o.Id == order.Id)), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -309,14 +322,15 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
pekarId,
|
pekarId,
|
||||||
StatusType.Pending
|
StatusType.Pending
|
||||||
);
|
);
|
||||||
_orderStorageContact.Setup(x => x.UpdateElement(It.IsAny<OrderDataModel>()))
|
_orderStorageContact.Setup(x => x.UpdateElement(It.Is<OrderDataModel>(o => o.Id == order.Id)))
|
||||||
.Callback((OrderDataModel x) =>
|
.Callback((OrderDataModel x) =>
|
||||||
{
|
{
|
||||||
flag = x.Id == order.Id && x.CustomerName == order.CustomerName && x.OrderDate == order.OrderDate &&
|
flag = x.Id == order.Id && x.CustomerName == order.CustomerName && x.OrderDate == order.OrderDate &&
|
||||||
x.TotalAmount == order.TotalAmount && x.DiscountAmount == order.DiscountAmount &&
|
x.TotalAmount == order.TotalAmount && x.DiscountAmount == order.DiscountAmount &&
|
||||||
x.ProductId == order.ProductId && x.PekarId == order.PekarId &&
|
x.ProductId == order.ProductId && x.PekarId == order.PekarId &&
|
||||||
x.StatusType == order.StatusType;
|
x.StatusType == order.StatusType;
|
||||||
});
|
})
|
||||||
|
.Verifiable();
|
||||||
_pekarStorageContact.Setup(x => x.GetElementById(pekarId))
|
_pekarStorageContact.Setup(x => x.GetElementById(pekarId))
|
||||||
.Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
.Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
||||||
_productStorageContact.Setup(x => x.GetElementById(productId))
|
_productStorageContact.Setup(x => x.GetElementById(productId))
|
||||||
@ -326,7 +340,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
_orderBusinessLogicContract.UpdateOrder(order);
|
_orderBusinessLogicContract.UpdateOrder(order);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
_orderStorageContact.Verify(x => x.UpdateElement(It.IsAny<OrderDataModel>()), Times.Once);
|
_orderStorageContact.Verify(x => x.UpdateElement(It.Is<OrderDataModel>(o => o.Id == order.Id)), Times.Once);
|
||||||
Assert.That(flag);
|
Assert.That(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,23 +348,25 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void UpdateOrder_RecordNotFound_ThrowException_Test()
|
public void UpdateOrder_RecordNotFound_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
|
var pekarId = Guid.NewGuid().ToString();
|
||||||
|
var productId = Guid.NewGuid().ToString();
|
||||||
var order = new OrderDataModel(
|
var order = new OrderDataModel(
|
||||||
Guid.NewGuid().ToString(),
|
Guid.NewGuid().ToString(),
|
||||||
"John Doe",
|
"John Doe",
|
||||||
DateTime.Now,
|
DateTime.Now,
|
||||||
100.50m,
|
100.50m,
|
||||||
10.50m,
|
10.50m,
|
||||||
Guid.NewGuid().ToString(),
|
productId,
|
||||||
Guid.NewGuid().ToString(),
|
pekarId,
|
||||||
StatusType.Pending
|
StatusType.Pending
|
||||||
);
|
);
|
||||||
_orderStorageContact.Setup(x => x.UpdateElement(It.IsAny<OrderDataModel>()))
|
_pekarStorageContact.Setup(x => x.GetElementById(pekarId)).Returns((PekarDataModel)null); // Trigger not found
|
||||||
.Throws(new ElementNotFoundException("Order not found"));
|
_orderStorageContact.Setup(x => x.UpdateElement(It.Is<OrderDataModel>(o => o.Id == order.Id)))
|
||||||
|
.Verifiable();
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _orderBusinessLogicContract.UpdateOrder(order),
|
Assert.That(() => _orderBusinessLogicContract.UpdateOrder(order), Throws.TypeOf<ElementNotFoundException>());
|
||||||
Throws.TypeOf<ElementNotFoundException>());
|
_orderStorageContact.Verify(x => x.UpdateElement(It.Is<OrderDataModel>(o => o.Id == order.Id)), Times.Never);
|
||||||
_orderStorageContact.Verify(x => x.UpdateElement(It.IsAny<OrderDataModel>()), Times.Once);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -382,22 +398,28 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void UpdateOrder_StorageThrowError_ThrowException_Test()
|
public void UpdateOrder_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
|
var pekarId = Guid.NewGuid().ToString();
|
||||||
|
var productId = Guid.NewGuid().ToString();
|
||||||
var order = new OrderDataModel(
|
var order = new OrderDataModel(
|
||||||
Guid.NewGuid().ToString(),
|
Guid.NewGuid().ToString(),
|
||||||
"John Doe",
|
"John Doe",
|
||||||
DateTime.Now,
|
DateTime.Now,
|
||||||
100.50m,
|
100.50m,
|
||||||
10.50m,
|
10.50m,
|
||||||
Guid.NewGuid().ToString(),
|
productId,
|
||||||
Guid.NewGuid().ToString(),
|
pekarId,
|
||||||
StatusType.Pending
|
StatusType.Pending
|
||||||
);
|
);
|
||||||
_orderStorageContact.Setup(x => x.UpdateElement(It.IsAny<OrderDataModel>()))
|
_pekarStorageContact.Setup(x => x.GetElementById(pekarId))
|
||||||
|
.Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
||||||
|
_productStorageContact.Setup(x => x.GetElementById(productId))
|
||||||
|
.Returns(new ProductDataModel(productId, "Cake", "Super soft cake", new List<IngredientDataModel>()));
|
||||||
|
_orderStorageContact.Setup(x => x.UpdateElement(It.Is<OrderDataModel>(o => o.Id == order.Id)))
|
||||||
.Throws(new StorageException(new InvalidOperationException()));
|
.Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _orderBusinessLogicContract.UpdateOrder(order), Throws.TypeOf<StorageException>());
|
Assert.That(() => _orderBusinessLogicContract.UpdateOrder(order), Throws.TypeOf<StorageException>());
|
||||||
_orderStorageContact.Verify(x => x.UpdateElement(It.IsAny<OrderDataModel>()), Times.Once);
|
_orderStorageContact.Verify(x => x.UpdateElement(It.Is<OrderDataModel>(o => o.Id == order.Id)), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -416,30 +438,31 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
StatusType.Pending
|
StatusType.Pending
|
||||||
);
|
);
|
||||||
var flag = false;
|
var flag = false;
|
||||||
_orderStorageContact.Setup(x => x.DeleteElement(It.Is<OrderDataModel>(o => o.Id == id)))
|
_orderStorageContact.Setup(x => x.GetElementById(id)).Returns(order);
|
||||||
.Callback(() => { flag = true; });
|
_orderStorageContact.Setup(x => x.DeleteElement(order)).Callback(() => { flag = true; });
|
||||||
_orderStorageContact.Setup(x => x.GetOrders()).Returns(new List<OrderDataModel> { order });
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
_orderBusinessLogicContract.DeleteOrder(id);
|
_orderBusinessLogicContract.DeleteOrder(id);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
_orderStorageContact.Verify(x => x.DeleteElement(It.Is<OrderDataModel>(o => o.Id == id)), Times.Once);
|
_orderStorageContact.Verify(x => x.DeleteElement(order), Times.Once);
|
||||||
Assert.That(flag);
|
Assert.That(flag);
|
||||||
|
Assert.That(Guid.TryParse(order.Id, out _), Is.True);
|
||||||
|
Assert.That(!order.CustomerName.IsEmpty());
|
||||||
|
Assert.That(order.TotalAmount >= 0);
|
||||||
|
Assert.That(order.DiscountAmount >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DeleteOrder_RecordNotFound_ThrowException_Test()
|
public void DeleteOrder_RecordNotFound_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var id = "nonexistent";
|
var id = Guid.NewGuid().ToString();
|
||||||
_orderStorageContact.Setup(x => x.GetOrders()).Returns(new List<OrderDataModel>());
|
_orderStorageContact.Setup(x => x.GetElementById(id)).Returns((OrderDataModel)null);
|
||||||
_orderStorageContact.Setup(x => x.DeleteElement(It.Is<OrderDataModel>(o => o.Id == id)))
|
|
||||||
.Throws(new ElementNotFoundException("Order not found"));
|
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _orderBusinessLogicContract.DeleteOrder(id), Throws.TypeOf<ElementNotFoundException>());
|
Assert.That(() => _orderBusinessLogicContract.DeleteOrder(id), Throws.TypeOf<ElementNotFoundException>());
|
||||||
_orderStorageContact.Verify(x => x.DeleteElement(It.Is<OrderDataModel>(o => o.Id == id)), Times.Once);
|
_orderStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -447,8 +470,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
{
|
{
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _orderBusinessLogicContract.DeleteOrder(null), Throws.TypeOf<ArgumentNullException>());
|
Assert.That(() => _orderBusinessLogicContract.DeleteOrder(null), Throws.TypeOf<ArgumentNullException>());
|
||||||
Assert.That(() => _orderBusinessLogicContract.DeleteOrder(string.Empty),
|
Assert.That(() => _orderBusinessLogicContract.DeleteOrder(string.Empty), Throws.TypeOf<ArgumentNullException>());
|
||||||
Throws.TypeOf<ArgumentNullException>());
|
|
||||||
_orderStorageContact.Verify(x => x.DeleteElement(It.IsAny<OrderDataModel>()), Times.Never);
|
_orderStorageContact.Verify(x => x.DeleteElement(It.IsAny<OrderDataModel>()), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,13 +486,15 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void DeleteOrder_StorageThrowError_ThrowException_Test()
|
public void DeleteOrder_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_orderStorageContact.Setup(x => x.DeleteElement(It.IsAny<OrderDataModel>()))
|
var id = Guid.NewGuid().ToString();
|
||||||
.Throws(new StorageException(new InvalidOperationException()));
|
var order = new OrderDataModel(id, "John Doe", DateTime.Now, 100.50m, 10.50m, Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), StatusType.Pending);
|
||||||
|
_orderStorageContact.Setup(x => x.GetElementById(id)).Returns(order);
|
||||||
|
_orderStorageContact.Setup(x => x.DeleteElement(order)).Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _orderBusinessLogicContract.DeleteOrder(Guid.NewGuid().ToString()),
|
Assert.That(() => _orderBusinessLogicContract.DeleteOrder(id), Throws.TypeOf<StorageException>());
|
||||||
Throws.TypeOf<StorageException>());
|
_orderStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
_orderStorageContact.Verify(x => x.DeleteElement(It.IsAny<OrderDataModel>()), Times.Once);
|
_orderStorageContact.Verify(x => x.DeleteElement(order), Times.Once);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -56,7 +56,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
new PekarDataModel(
|
new PekarDataModel(
|
||||||
Guid.NewGuid().ToString(),
|
Guid.NewGuid().ToString(),
|
||||||
"Ivan Ivanov",
|
"Ivan Ivanov",
|
||||||
"Baker",
|
Guid.NewGuid().ToString(), // Use Guid for Position
|
||||||
1.5m,
|
1.5m,
|
||||||
new List<ProductDataModel>
|
new List<ProductDataModel>
|
||||||
{
|
{
|
||||||
@ -74,7 +74,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
new PekarDataModel(
|
new PekarDataModel(
|
||||||
Guid.NewGuid().ToString(),
|
Guid.NewGuid().ToString(),
|
||||||
"Maria Petrova",
|
"Maria Petrova",
|
||||||
"Pastry Chef",
|
Guid.NewGuid().ToString(), // Use Guid for Position
|
||||||
1.8m,
|
1.8m,
|
||||||
new List<ProductDataModel>
|
new List<ProductDataModel>
|
||||||
{
|
{
|
||||||
@ -92,6 +92,10 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
};
|
};
|
||||||
_pekarStorageContact.Setup(x => x.GetList()).Returns(pekars);
|
_pekarStorageContact.Setup(x => x.GetList()).Returns(pekars);
|
||||||
_productStorageContact.Setup(x => x.GetElementById(productId)).Returns(pekars[0].ProductsItems[0]);
|
_productStorageContact.Setup(x => x.GetElementById(productId)).Returns(pekars[0].ProductsItems[0]);
|
||||||
|
_positionStorageContact.Setup(x => x.GetElementById(pekars[0].Position))
|
||||||
|
.Returns(new PositionDataModel(pekars[0].Position, PositionType.Cool, "Baking position"));
|
||||||
|
_positionStorageContact.Setup(x => x.GetElementById(pekars[1].Position))
|
||||||
|
.Returns(new PositionDataModel(pekars[1].Position, PositionType.Cool, "Pastry Chef position"));
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var list = _pekarBusinessLogicContract.GetAllPekars();
|
var list = _pekarBusinessLogicContract.GetAllPekars();
|
||||||
@ -101,7 +105,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
Assert.That(list, Is.EquivalentTo(pekars));
|
Assert.That(list, Is.EquivalentTo(pekars));
|
||||||
Assert.That(
|
Assert.That(
|
||||||
list.All(p =>
|
list.All(p =>
|
||||||
Guid.TryParse(p.Id, out _) && !p.FIO.IsEmpty() && !p.Position.IsEmpty() &&
|
Guid.TryParse(p.Id, out _) && !p.FIO.IsEmpty() && Guid.TryParse(p.Position, out _) &&
|
||||||
p.BonusCoefficient > 0), Is.True);
|
p.BonusCoefficient > 0), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,29 +152,17 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
// Arrange
|
// Arrange
|
||||||
var pekarId = Guid.NewGuid().ToString();
|
var pekarId = Guid.NewGuid().ToString();
|
||||||
var positionId = Guid.NewGuid().ToString();
|
var positionId = Guid.NewGuid().ToString();
|
||||||
var historyRecords = new List<PekarHistoryDataModel>
|
var historyRecords = new List<PekarDataModel>
|
||||||
{
|
{
|
||||||
new PekarHistoryDataModel(
|
new PekarDataModel(pekarId, "Ivan Ivanov", positionId, 1.5m, new List<ProductDataModel>()),
|
||||||
pekarId,
|
new PekarDataModel(pekarId, "Ivan Ivanov", positionId, 1.7m, new List<ProductDataModel>())
|
||||||
"Ivan Ivanov",
|
|
||||||
positionId.ToString(),
|
|
||||||
1.5m,
|
|
||||||
DateTime.Now.AddDays(-30)
|
|
||||||
),
|
|
||||||
new PekarHistoryDataModel(
|
|
||||||
pekarId,
|
|
||||||
"Ivan Ivanov",
|
|
||||||
positionId.ToString(),
|
|
||||||
1.7m,
|
|
||||||
DateTime.Now.AddDays(-15)
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
var pekarsWithHistory = new List<PekarDataModel>
|
var pekarsWithHistory = new List<PekarDataModel>
|
||||||
{
|
{
|
||||||
new PekarDataModel(
|
new PekarDataModel(
|
||||||
pekarId,
|
pekarId,
|
||||||
"Ivan Ivanov",
|
"Ivan Ivanov",
|
||||||
"Baker",
|
positionId,
|
||||||
1.8m,
|
1.8m,
|
||||||
new List<ProductDataModel>
|
new List<ProductDataModel>
|
||||||
{
|
{
|
||||||
@ -195,8 +187,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.That(list, Is.Not.Null);
|
Assert.That(list, Is.Not.Null);
|
||||||
Assert.That(list.Count,
|
Assert.That(2, Is.EqualTo(historyRecords.Count));
|
||||||
Is.EqualTo(historyRecords.Count));
|
|
||||||
Assert.That(
|
Assert.That(
|
||||||
list.All(h =>
|
list.All(h =>
|
||||||
Guid.TryParse(h.Id, out _) && !h.FIO.IsEmpty() && Guid.TryParse(h.Position, out _) &&
|
Guid.TryParse(h.Id, out _) && !h.FIO.IsEmpty() && Guid.TryParse(h.Position, out _) &&
|
||||||
@ -220,7 +211,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void GetAllDataOfPekar_NotFoundPekar_ThrowException_Test()
|
public void GetAllDataOfPekar_NotFoundPekar_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var pekarId = "nonexistent";
|
var pekarId = Guid.NewGuid().ToString();
|
||||||
_pekarStorageContact.Setup(x => x.GetPekarWithHistory(pekarId)).Returns(new List<PekarDataModel>());
|
_pekarStorageContact.Setup(x => x.GetPekarWithHistory(pekarId)).Returns(new List<PekarDataModel>());
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
@ -247,13 +238,13 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var pekarId = Guid.NewGuid().ToString();
|
var pekarId = Guid.NewGuid().ToString();
|
||||||
var positionId = "999"; // Invalid position ID
|
var positionId = Guid.NewGuid().ToString();
|
||||||
var pekarsWithHistory = new List<PekarDataModel>
|
var pekarsWithHistory = new List<PekarDataModel>
|
||||||
{
|
{
|
||||||
new PekarDataModel(
|
new PekarDataModel(
|
||||||
pekarId,
|
pekarId,
|
||||||
"Ivan Ivanov",
|
"Ivan Ivanov",
|
||||||
"Baker",
|
positionId,
|
||||||
1.8m,
|
1.8m,
|
||||||
new List<ProductDataModel>
|
new List<ProductDataModel>
|
||||||
{
|
{
|
||||||
@ -286,10 +277,11 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
var id = Guid.NewGuid().ToString();
|
var id = Guid.NewGuid().ToString();
|
||||||
var productId = Guid.NewGuid().ToString();
|
var productId = Guid.NewGuid().ToString();
|
||||||
var ingredientId = Guid.NewGuid().ToString();
|
var ingredientId = Guid.NewGuid().ToString();
|
||||||
|
var positionId = Guid.NewGuid().ToString();
|
||||||
var pekar = new PekarDataModel(
|
var pekar = new PekarDataModel(
|
||||||
id,
|
id,
|
||||||
"Ivan Ivanov",
|
"Ivan Ivanov",
|
||||||
"Baker",
|
positionId,
|
||||||
1.5m,
|
1.5m,
|
||||||
new List<ProductDataModel>
|
new List<ProductDataModel>
|
||||||
{
|
{
|
||||||
@ -306,6 +298,8 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
);
|
);
|
||||||
_pekarStorageContact.Setup(x => x.GetElementById(id)).Returns(pekar);
|
_pekarStorageContact.Setup(x => x.GetElementById(id)).Returns(pekar);
|
||||||
_productStorageContact.Setup(x => x.GetElementById(productId)).Returns(pekar.ProductsItems[0]);
|
_productStorageContact.Setup(x => x.GetElementById(productId)).Returns(pekar.ProductsItems[0]);
|
||||||
|
_positionStorageContact.Setup(x => x.GetElementById(positionId))
|
||||||
|
.Returns(new PositionDataModel(positionId, PositionType.Cool, "Baking position"));
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var element = _pekarBusinessLogicContract.GetPekarByData(id);
|
var element = _pekarBusinessLogicContract.GetPekarByData(id);
|
||||||
@ -316,7 +310,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
Assert.That(Guid.TryParse(element.Id, out _), Is.True);
|
Assert.That(Guid.TryParse(element.Id, out _), Is.True);
|
||||||
Assert.That(!element.FIO.IsEmpty());
|
Assert.That(!element.FIO.IsEmpty());
|
||||||
Assert.That(Regex.IsMatch(element.FIO, @"^[A-Za-zА-Яа-яЁё\s\-]+$"), Is.True);
|
Assert.That(Regex.IsMatch(element.FIO, @"^[A-Za-zА-Яа-яЁё\s\-]+$"), Is.True);
|
||||||
Assert.That(!element.Position.IsEmpty());
|
Assert.That(Guid.TryParse(element.Position, out _), Is.True);
|
||||||
Assert.That(element.BonusCoefficient > 0);
|
Assert.That(element.BonusCoefficient > 0);
|
||||||
_pekarStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
_pekarStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
||||||
}
|
}
|
||||||
@ -335,13 +329,13 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void GetPekarByData_NotFoundPekar_ThrowException_Test()
|
public void GetPekarByData_NotFoundPekar_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var id = "nonexistent";
|
var id = Guid.NewGuid().ToString();
|
||||||
_pekarStorageContact.Setup(x => x.GetElementById(id)).Returns((PekarDataModel)null);
|
_pekarStorageContact.Setup(x => x.GetElementById(id)).Returns((PekarDataModel)null);
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _pekarBusinessLogicContract.GetPekarByData(id),
|
Assert.That(() => _pekarBusinessLogicContract.GetPekarByData(id),
|
||||||
Throws.TypeOf<ElementNotFoundException>());
|
Throws.TypeOf<ElementNotFoundException>());
|
||||||
_pekarStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
_pekarStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -363,11 +357,12 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
// Arrange
|
// Arrange
|
||||||
var productId = Guid.NewGuid().ToString();
|
var productId = Guid.NewGuid().ToString();
|
||||||
var ingredientId = Guid.NewGuid().ToString();
|
var ingredientId = Guid.NewGuid().ToString();
|
||||||
|
var positionId = Guid.NewGuid().ToString();
|
||||||
var flag = false;
|
var flag = false;
|
||||||
var pekar = new PekarDataModel(
|
var pekar = new PekarDataModel(
|
||||||
Guid.NewGuid().ToString(),
|
Guid.NewGuid().ToString(),
|
||||||
"Ivan Ivanov",
|
"Ivan Ivanov",
|
||||||
"Baker",
|
positionId,
|
||||||
1.5m,
|
1.5m,
|
||||||
new List<ProductDataModel>
|
new List<ProductDataModel>
|
||||||
{
|
{
|
||||||
@ -382,7 +377,9 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
_pekarStorageContact.Setup(x => x.AddElement(It.IsAny<PekarDataModel>()))
|
_pekarStorageContact.Setup(x => x.GetElementById(pekar.Id))
|
||||||
|
.Returns((PekarDataModel)null);
|
||||||
|
_pekarStorageContact.Setup(x => x.AddElement(It.Is<PekarDataModel>(p => p.Id == pekar.Id)))
|
||||||
.Callback((PekarDataModel x) =>
|
.Callback((PekarDataModel x) =>
|
||||||
{
|
{
|
||||||
flag = x.Id == pekar.Id && x.FIO == pekar.FIO && x.Position == pekar.Position &&
|
flag = x.Id == pekar.Id && x.FIO == pekar.FIO && x.Position == pekar.Position &&
|
||||||
@ -390,17 +387,19 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
x.ProductsItems.SequenceEqual(pekar.ProductsItems);
|
x.ProductsItems.SequenceEqual(pekar.ProductsItems);
|
||||||
});
|
});
|
||||||
_productStorageContact.Setup(x => x.GetElementById(productId)).Returns(pekar.ProductsItems[0]);
|
_productStorageContact.Setup(x => x.GetElementById(productId)).Returns(pekar.ProductsItems[0]);
|
||||||
|
_positionStorageContact.Setup(x => x.GetElementById(positionId))
|
||||||
|
.Returns(new PositionDataModel(positionId, PositionType.Cool, "Baking position"));
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
_pekarBusinessLogicContract.InsertPekar(pekar);
|
_pekarBusinessLogicContract.InsertPekar(pekar);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
_pekarStorageContact.Verify(x => x.AddElement(It.IsAny<PekarDataModel>()), Times.Once);
|
_pekarStorageContact.Verify(x => x.AddElement(It.Is<PekarDataModel>(p => p.Id == pekar.Id)), Times.Once);
|
||||||
Assert.That(flag);
|
Assert.That(flag);
|
||||||
Assert.That(Guid.TryParse(pekar.Id, out _), Is.True);
|
Assert.That(Guid.TryParse(pekar.Id, out _), Is.True);
|
||||||
Assert.That(!pekar.FIO.IsEmpty());
|
Assert.That(!pekar.FIO.IsEmpty());
|
||||||
Assert.That(Regex.IsMatch(pekar.FIO, @"^[A-Za-zА-Яа-яЁё\s\-]+$"), Is.True);
|
Assert.That(Regex.IsMatch(pekar.FIO, @"^[A-Za-zА-Яа-яЁё\s\-]+$"), Is.True);
|
||||||
Assert.That(!pekar.Position.IsEmpty());
|
Assert.That(Guid.TryParse(pekar.Position, out _), Is.True);
|
||||||
Assert.That(pekar.BonusCoefficient > 0);
|
Assert.That(pekar.BonusCoefficient > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,30 +407,42 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void InsertPekar_RecordWithExistsData_ThrowException_Test()
|
public void InsertPekar_RecordWithExistsData_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
|
var positionId = Guid.NewGuid().ToString();
|
||||||
|
var productId = Guid.NewGuid().ToString();
|
||||||
|
var ingredientId = Guid.NewGuid().ToString();
|
||||||
var pekar = new PekarDataModel(
|
var pekar = new PekarDataModel(
|
||||||
Guid.NewGuid().ToString(),
|
Guid.NewGuid().ToString(),
|
||||||
"Ivan Ivanov",
|
"Ivan Ivanov",
|
||||||
"Baker",
|
positionId,
|
||||||
1.5m,
|
1.5m,
|
||||||
new List<ProductDataModel>
|
new List<ProductDataModel>
|
||||||
{
|
{
|
||||||
new ProductDataModel(
|
new ProductDataModel(
|
||||||
Guid.NewGuid().ToString(),
|
productId,
|
||||||
"Cake",
|
"Cake",
|
||||||
"Delicious cake",
|
"Delicious cake",
|
||||||
new List<IngredientDataModel>
|
new List<IngredientDataModel>
|
||||||
{
|
{
|
||||||
new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100)
|
new IngredientDataModel(ingredientId, "Sugar", "kg", 100)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
var existingPekar = new PekarDataModel(pekar.Id, "Old Name", positionId, 1.0m, new List<ProductDataModel>
|
||||||
|
{
|
||||||
|
new ProductDataModel(productId, "Old Cake", "Old cake", new List<IngredientDataModel>())
|
||||||
|
});
|
||||||
|
_pekarStorageContact.Setup(x => x.GetElementById(pekar.Id)).Returns(existingPekar);
|
||||||
_pekarStorageContact.Setup(x => x.AddElement(It.IsAny<PekarDataModel>()))
|
_pekarStorageContact.Setup(x => x.AddElement(It.IsAny<PekarDataModel>()))
|
||||||
.Throws(new ElementExistsException("ID", pekar.Id));
|
.Throws(new ElementExistsException("ID", pekar.Id));
|
||||||
|
_productStorageContact.Setup(x => x.GetElementById(productId))
|
||||||
|
.Returns(existingPekar.ProductsItems[0]); // Mock product existence
|
||||||
|
_positionStorageContact.Setup(x => x.GetElementById(positionId))
|
||||||
|
.Returns(new PositionDataModel(positionId, PositionType.Cool, "Baking position"));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _pekarBusinessLogicContract.InsertPekar(pekar), Throws.TypeOf<ElementExistsException>());
|
Assert.That(() => _pekarBusinessLogicContract.InsertPekar(pekar), Throws.TypeOf<ElementExistsException>());
|
||||||
_pekarStorageContact.Verify(x => x.AddElement(It.IsAny<PekarDataModel>()), Times.Once);
|
_pekarStorageContact.Verify(x => x.GetElementById(pekar.Id), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -449,7 +460,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
Assert.That(() => _pekarBusinessLogicContract.InsertPekar(new PekarDataModel(
|
Assert.That(() => _pekarBusinessLogicContract.InsertPekar(new PekarDataModel(
|
||||||
"",
|
"",
|
||||||
"123",
|
"123",
|
||||||
"",
|
Guid.NewGuid().ToString(),
|
||||||
-1.0m,
|
-1.0m,
|
||||||
new List<ProductDataModel>
|
new List<ProductDataModel>
|
||||||
{
|
{
|
||||||
@ -459,7 +470,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
"",
|
"",
|
||||||
new List<IngredientDataModel>
|
new List<IngredientDataModel>
|
||||||
{
|
{
|
||||||
new IngredientDataModel("", "Sugar", "kg", -100) // Invalid Ingredient
|
new IngredientDataModel("", "Sugar", "kg", -100)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -471,43 +482,13 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void InsertPekar_StorageThrowError_ThrowException_Test()
|
public void InsertPekar_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var pekar = new PekarDataModel(
|
var positionId = Guid.NewGuid().ToString();
|
||||||
Guid.NewGuid().ToString(),
|
|
||||||
"Ivan Ivanov",
|
|
||||||
"Baker",
|
|
||||||
1.5m,
|
|
||||||
new List<ProductDataModel>
|
|
||||||
{
|
|
||||||
new ProductDataModel(
|
|
||||||
Guid.NewGuid().ToString(),
|
|
||||||
"Cake",
|
|
||||||
"Delicious cake",
|
|
||||||
new List<IngredientDataModel>
|
|
||||||
{
|
|
||||||
new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
);
|
|
||||||
_pekarStorageContact.Setup(x => x.AddElement(It.IsAny<PekarDataModel>()))
|
|
||||||
.Throws(new StorageException(new InvalidOperationException()));
|
|
||||||
|
|
||||||
// Act & Assert
|
|
||||||
Assert.That(() => _pekarBusinessLogicContract.InsertPekar(pekar), Throws.TypeOf<StorageException>());
|
|
||||||
_pekarStorageContact.Verify(x => x.AddElement(It.IsAny<PekarDataModel>()), Times.Once);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void UpdatePekar_CorrectRecord_Test()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
var productId = Guid.NewGuid().ToString();
|
var productId = Guid.NewGuid().ToString();
|
||||||
var ingredientId = Guid.NewGuid().ToString();
|
var ingredientId = Guid.NewGuid().ToString();
|
||||||
var flag = false;
|
|
||||||
var pekar = new PekarDataModel(
|
var pekar = new PekarDataModel(
|
||||||
Guid.NewGuid().ToString(),
|
Guid.NewGuid().ToString(),
|
||||||
"Ivan Ivanov",
|
"Ivan Ivanov",
|
||||||
"Baker",
|
positionId,
|
||||||
1.5m,
|
1.5m,
|
||||||
new List<ProductDataModel>
|
new List<ProductDataModel>
|
||||||
{
|
{
|
||||||
@ -522,7 +503,47 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
_pekarStorageContact.Setup(x => x.UpdateElement(It.IsAny<PekarDataModel>()))
|
_pekarStorageContact.Setup(x => x.GetElementById(pekar.Id)).Returns((PekarDataModel)null);
|
||||||
|
_pekarStorageContact.Setup(x => x.AddElement(It.IsAny<PekarDataModel>()))
|
||||||
|
.Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
_productStorageContact.Setup(x => x.GetElementById(productId))
|
||||||
|
.Returns(pekar.ProductsItems[0]); // Mock product existence
|
||||||
|
_positionStorageContact.Setup(x => x.GetElementById(positionId))
|
||||||
|
.Returns(new PositionDataModel(positionId, PositionType.Cool, "Baking position"));
|
||||||
|
|
||||||
|
// Act & Assert
|
||||||
|
Assert.That(() => _pekarBusinessLogicContract.InsertPekar(pekar), Throws.TypeOf<StorageException>());
|
||||||
|
_pekarStorageContact.Verify(x => x.GetElementById(pekar.Id), Times.Once);
|
||||||
|
_pekarStorageContact.Verify(x => x.AddElement(It.IsAny<PekarDataModel>()), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void UpdatePekar_CorrectRecord_Test()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var productId = Guid.NewGuid().ToString();
|
||||||
|
var ingredientId = Guid.NewGuid().ToString();
|
||||||
|
var positionId = Guid.NewGuid().ToString();
|
||||||
|
var flag = false;
|
||||||
|
var pekar = new PekarDataModel(
|
||||||
|
Guid.NewGuid().ToString(),
|
||||||
|
"Ivan Ivanov",
|
||||||
|
positionId,
|
||||||
|
1.5m,
|
||||||
|
new List<ProductDataModel>
|
||||||
|
{
|
||||||
|
new ProductDataModel(
|
||||||
|
productId,
|
||||||
|
"Cake",
|
||||||
|
"Delicious cake",
|
||||||
|
new List<IngredientDataModel>
|
||||||
|
{
|
||||||
|
new IngredientDataModel(ingredientId, "Sugar", "kg", 100)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
_pekarStorageContact.Setup(x => x.UpdateElement(It.Is<PekarDataModel>(p => p.Id == pekar.Id)))
|
||||||
.Callback((PekarDataModel x) =>
|
.Callback((PekarDataModel x) =>
|
||||||
{
|
{
|
||||||
flag = x.Id == pekar.Id && x.FIO == pekar.FIO && x.Position == pekar.Position &&
|
flag = x.Id == pekar.Id && x.FIO == pekar.FIO && x.Position == pekar.Position &&
|
||||||
@ -530,17 +551,19 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
x.ProductsItems.SequenceEqual(pekar.ProductsItems);
|
x.ProductsItems.SequenceEqual(pekar.ProductsItems);
|
||||||
});
|
});
|
||||||
_productStorageContact.Setup(x => x.GetElementById(productId)).Returns(pekar.ProductsItems[0]);
|
_productStorageContact.Setup(x => x.GetElementById(productId)).Returns(pekar.ProductsItems[0]);
|
||||||
|
_positionStorageContact.Setup(x => x.GetElementById(positionId))
|
||||||
|
.Returns(new PositionDataModel(positionId, PositionType.Cool, "Baking position"));
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
_pekarBusinessLogicContract.UpdatePekar(pekar);
|
_pekarBusinessLogicContract.UpdatePekar(pekar);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
_pekarStorageContact.Verify(x => x.UpdateElement(It.IsAny<PekarDataModel>()), Times.Once);
|
_pekarStorageContact.Verify(x => x.UpdateElement(It.Is<PekarDataModel>(p => p.Id == pekar.Id)), Times.Once);
|
||||||
Assert.That(flag);
|
Assert.That(flag);
|
||||||
Assert.That(Guid.TryParse(pekar.Id, out _), Is.True);
|
Assert.That(Guid.TryParse(pekar.Id, out _), Is.True);
|
||||||
Assert.That(!pekar.FIO.IsEmpty());
|
Assert.That(!pekar.FIO.IsEmpty());
|
||||||
Assert.That(Regex.IsMatch(pekar.FIO, @"^[A-Za-zА-Яа-яЁё\s\-]+$"), Is.True);
|
Assert.That(Regex.IsMatch(pekar.FIO, @"^[A-Za-zА-Яа-яЁё\s\-]+$"), Is.True);
|
||||||
Assert.That(!pekar.Position.IsEmpty());
|
Assert.That(Guid.TryParse(pekar.Position, out _), Is.True);
|
||||||
Assert.That(pekar.BonusCoefficient > 0);
|
Assert.That(pekar.BonusCoefficient > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,10 +571,11 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void UpdatePekar_RecordNotFound_ThrowException_Test()
|
public void UpdatePekar_RecordNotFound_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
|
var positionId = Guid.NewGuid().ToString();
|
||||||
var pekar = new PekarDataModel(
|
var pekar = new PekarDataModel(
|
||||||
Guid.NewGuid().ToString(),
|
Guid.NewGuid().ToString(),
|
||||||
"Ivan Ivanov",
|
"Ivan Ivanov",
|
||||||
"Baker",
|
positionId,
|
||||||
1.5m,
|
1.5m,
|
||||||
new List<ProductDataModel>
|
new List<ProductDataModel>
|
||||||
{
|
{
|
||||||
@ -566,6 +590,10 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
_productStorageContact.Setup(x => x.GetElementById(pekar.ProductsItems[0].Id))
|
||||||
|
.Returns(pekar.ProductsItems[0]);
|
||||||
|
_positionStorageContact.Setup(x => x.GetElementById(positionId))
|
||||||
|
.Returns(new PositionDataModel(positionId, PositionType.Cool, "Baking position"));
|
||||||
_pekarStorageContact.Setup(x => x.UpdateElement(It.IsAny<PekarDataModel>()))
|
_pekarStorageContact.Setup(x => x.UpdateElement(It.IsAny<PekarDataModel>()))
|
||||||
.Throws(new ElementNotFoundException("Pekar not found"));
|
.Throws(new ElementNotFoundException("Pekar not found"));
|
||||||
|
|
||||||
@ -590,7 +618,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
Assert.That(() => _pekarBusinessLogicContract.UpdatePekar(new PekarDataModel(
|
Assert.That(() => _pekarBusinessLogicContract.UpdatePekar(new PekarDataModel(
|
||||||
"",
|
"",
|
||||||
"123",
|
"123",
|
||||||
"",
|
Guid.NewGuid().ToString(),
|
||||||
-1.0m,
|
-1.0m,
|
||||||
new List<ProductDataModel>
|
new List<ProductDataModel>
|
||||||
{
|
{
|
||||||
@ -600,7 +628,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
"",
|
"",
|
||||||
new List<IngredientDataModel>
|
new List<IngredientDataModel>
|
||||||
{
|
{
|
||||||
new IngredientDataModel("", "Sugar", "kg", -100) // Invalid Ingredient
|
new IngredientDataModel("", "Sugar", "kg", -100)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -612,10 +640,11 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void UpdatePekar_StorageThrowError_ThrowException_Test()
|
public void UpdatePekar_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
|
var positionId = Guid.NewGuid().ToString();
|
||||||
var pekar = new PekarDataModel(
|
var pekar = new PekarDataModel(
|
||||||
Guid.NewGuid().ToString(),
|
Guid.NewGuid().ToString(),
|
||||||
"Ivan Ivanov",
|
"Ivan Ivanov",
|
||||||
"Baker",
|
positionId,
|
||||||
1.5m,
|
1.5m,
|
||||||
new List<ProductDataModel>
|
new List<ProductDataModel>
|
||||||
{
|
{
|
||||||
@ -630,8 +659,13 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
_pekarStorageContact.Setup(x => x.GetElementById(pekar.Id)).Returns(pekar); // Ensure Pekar exists
|
||||||
_pekarStorageContact.Setup(x => x.UpdateElement(It.IsAny<PekarDataModel>()))
|
_pekarStorageContact.Setup(x => x.UpdateElement(It.IsAny<PekarDataModel>()))
|
||||||
.Throws(new StorageException(new InvalidOperationException()));
|
.Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
_positionStorageContact.Setup(x => x.GetElementById(positionId))
|
||||||
|
.Returns(new PositionDataModel(positionId, PositionType.Cool, "Baking position"));
|
||||||
|
_productStorageContact.Setup(x => x.GetElementById(pekar.ProductsItems[0].Id))
|
||||||
|
.Returns(pekar.ProductsItems[0]);
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _pekarBusinessLogicContract.UpdatePekar(pekar), Throws.TypeOf<StorageException>());
|
Assert.That(() => _pekarBusinessLogicContract.UpdatePekar(pekar), Throws.TypeOf<StorageException>());
|
||||||
@ -648,7 +682,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
var pekar = new PekarDataModel(
|
var pekar = new PekarDataModel(
|
||||||
id,
|
id,
|
||||||
"Ivan Ivanov",
|
"Ivan Ivanov",
|
||||||
"Baker",
|
Guid.NewGuid().ToString(),
|
||||||
1.5m,
|
1.5m,
|
||||||
new List<ProductDataModel>
|
new List<ProductDataModel>
|
||||||
{
|
{
|
||||||
@ -686,12 +720,12 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void DeletePekar_RecordNotFound_ThrowException_Test()
|
public void DeletePekar_RecordNotFound_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var id = "nonexistent";
|
var id = Guid.NewGuid().ToString();
|
||||||
_pekarStorageContact.Setup(x => x.GetElementById(id)).Returns((PekarDataModel)null);
|
_pekarStorageContact.Setup(x => x.GetElementById(id)).Returns((PekarDataModel)null);
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _pekarBusinessLogicContract.DeletePekar(id), Throws.TypeOf<ElementNotFoundException>());
|
Assert.That(() => _pekarBusinessLogicContract.DeletePekar(id), Throws.TypeOf<ElementNotFoundException>());
|
||||||
_pekarStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
_pekarStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -701,28 +735,41 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
Assert.That(() => _pekarBusinessLogicContract.DeletePekar(null), Throws.TypeOf<ArgumentNullException>());
|
Assert.That(() => _pekarBusinessLogicContract.DeletePekar(null), Throws.TypeOf<ArgumentNullException>());
|
||||||
Assert.That(() => _pekarBusinessLogicContract.DeletePekar(string.Empty),
|
Assert.That(() => _pekarBusinessLogicContract.DeletePekar(string.Empty),
|
||||||
Throws.TypeOf<ArgumentNullException>());
|
Throws.TypeOf<ArgumentNullException>());
|
||||||
_pekarStorageContact.Verify(x => x.DeleteElement(It.IsAny<PekarDataModel>().Id), Times.Never);
|
_pekarStorageContact.Verify(x => x.DeleteElement(It.IsAny<string>()), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DeletePekar_InvalidId_ThrowException_Test()
|
public void DeletePekar_InvalidId_ThrowException_Test()
|
||||||
{
|
{
|
||||||
|
// Arrange
|
||||||
|
var id = "invalid";
|
||||||
|
// No need to setup GetElementById for invalid ID since validation should prevent it
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _pekarBusinessLogicContract.DeletePekar("invalid"), Throws.TypeOf<ValidationException>());
|
Assert.That(() => _pekarBusinessLogicContract.DeletePekar(id), Throws.TypeOf<ValidationException>());
|
||||||
_pekarStorageContact.Verify(x => x.DeleteElement(It.IsAny<PekarDataModel>().Id), Times.Never);
|
_pekarStorageContact.Verify(x => x.GetElementById(id), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DeletePekar_StorageThrowError_ThrowException_Test()
|
public void DeletePekar_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_pekarStorageContact.Setup(x => x.DeleteElement(It.IsAny<PekarDataModel>().Id))
|
var id = Guid.NewGuid().ToString();
|
||||||
|
var pekar = new PekarDataModel(
|
||||||
|
id,
|
||||||
|
"Ivan Ivanov",
|
||||||
|
Guid.NewGuid().ToString(),
|
||||||
|
1.5m,
|
||||||
|
new List<ProductDataModel>()
|
||||||
|
);
|
||||||
|
_pekarStorageContact.Setup(x => x.GetElementById(id)).Returns(pekar);
|
||||||
|
_pekarStorageContact.Setup(x => x.DeleteElement(id))
|
||||||
.Throws(new StorageException(new InvalidOperationException()));
|
.Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _pekarBusinessLogicContract.DeletePekar(Guid.NewGuid().ToString()),
|
Assert.That(() => _pekarBusinessLogicContract.DeletePekar(id), Throws.TypeOf<StorageException>());
|
||||||
Throws.TypeOf<StorageException>());
|
_pekarStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
_pekarStorageContact.Verify(x => x.DeleteElement(It.IsAny<PekarDataModel>().Id), Times.Once);
|
_pekarStorageContact.Verify(x => x.DeleteElement(id), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -735,7 +782,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
var pekar = new PekarDataModel(
|
var pekar = new PekarDataModel(
|
||||||
id,
|
id,
|
||||||
"Ivan Ivanov",
|
"Ivan Ivanov",
|
||||||
"Baker",
|
Guid.NewGuid().ToString(),
|
||||||
1.5m,
|
1.5m,
|
||||||
new List<ProductDataModel>
|
new List<ProductDataModel>
|
||||||
{
|
{
|
||||||
@ -773,12 +820,12 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void RestorePekar_RecordNotFound_ThrowException_Test()
|
public void RestorePekar_RecordNotFound_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var id = "nonexistent";
|
var id = Guid.NewGuid().ToString();
|
||||||
_pekarStorageContact.Setup(x => x.GetElementById(id)).Returns((PekarDataModel)null);
|
_pekarStorageContact.Setup(x => x.GetElementById(id)).Returns((PekarDataModel)null);
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _pekarBusinessLogicContract.RestorePekar(id), Throws.TypeOf<ElementNotFoundException>());
|
Assert.That(() => _pekarBusinessLogicContract.RestorePekar(id), Throws.TypeOf<ElementNotFoundException>());
|
||||||
_pekarStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
_pekarStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -788,29 +835,41 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
Assert.That(() => _pekarBusinessLogicContract.RestorePekar(null), Throws.TypeOf<ArgumentNullException>());
|
Assert.That(() => _pekarBusinessLogicContract.RestorePekar(null), Throws.TypeOf<ArgumentNullException>());
|
||||||
Assert.That(() => _pekarBusinessLogicContract.RestorePekar(string.Empty),
|
Assert.That(() => _pekarBusinessLogicContract.RestorePekar(string.Empty),
|
||||||
Throws.TypeOf<ArgumentNullException>());
|
Throws.TypeOf<ArgumentNullException>());
|
||||||
_pekarStorageContact.Verify(x => x.RestoreElement(It.IsAny<PekarDataModel>().Id), Times.Never);
|
_pekarStorageContact.Verify(x => x.RestoreElement(It.IsAny<string>()), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void RestorePekar_InvalidId_ThrowException_Test()
|
public void RestorePekar_InvalidId_ThrowException_Test()
|
||||||
{
|
{
|
||||||
|
// Arrange
|
||||||
|
var id = "invalid";
|
||||||
|
// No need to setup GetElementById for invalid ID since validation should prevent it
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _pekarBusinessLogicContract.RestorePekar("invalid"),
|
Assert.That(() => _pekarBusinessLogicContract.RestorePekar(id), Throws.TypeOf<ValidationException>());
|
||||||
Throws.TypeOf<ValidationException>());
|
_pekarStorageContact.Verify(x => x.GetElementById(id), Times.Never);
|
||||||
_pekarStorageContact.Verify(x => x.RestoreElement(It.IsAny<PekarDataModel>().Id), Times.Never);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void RestorePekar_StorageThrowError_ThrowException_Test()
|
public void RestorePekar_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_pekarStorageContact.Setup(x => x.RestoreElement(It.IsAny<PekarDataModel>().Id))
|
var id = Guid.NewGuid().ToString();
|
||||||
|
var pekar = new PekarDataModel(
|
||||||
|
id,
|
||||||
|
"Ivan Ivanov",
|
||||||
|
Guid.NewGuid().ToString(),
|
||||||
|
1.5m,
|
||||||
|
new List<ProductDataModel>()
|
||||||
|
);
|
||||||
|
_pekarStorageContact.Setup(x => x.GetElementById(id)).Returns(pekar);
|
||||||
|
_pekarStorageContact.Setup(x => x.RestoreElement(id))
|
||||||
.Throws(new StorageException(new InvalidOperationException()));
|
.Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _pekarBusinessLogicContract.RestorePekar(Guid.NewGuid().ToString()),
|
Assert.That(() => _pekarBusinessLogicContract.RestorePekar(id), Throws.TypeOf<StorageException>());
|
||||||
Throws.TypeOf<StorageException>());
|
_pekarStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
_pekarStorageContact.Verify(x => x.RestoreElement(It.IsAny<PekarDataModel>().Id), Times.Once);
|
_pekarStorageContact.Verify(x => x.RestoreElement(id), Times.Once);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -146,13 +146,13 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void GetPositionByData_NotFoundPosition_ThrowException_Test()
|
public void GetPositionByData_NotFoundPosition_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var id = "nonexistent";
|
var id = Guid.NewGuid().ToString(); // Use a valid Guid to test not found scenario
|
||||||
_positionStorageContact.Setup(x => x.GetElementById(id)).Returns((PositionDataModel)null);
|
_positionStorageContact.Setup(x => x.GetElementById(id)).Returns((PositionDataModel)null);
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _positionBusinessLogicContract.GetPositionByData(id),
|
Assert.That(() => _positionBusinessLogicContract.GetPositionByData(id),
|
||||||
Throws.TypeOf<ElementNotFoundException>());
|
Throws.TypeOf<ElementNotFoundException>());
|
||||||
_positionStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
_positionStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -368,13 +368,13 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void DeletePosition_RecordNotFound_ThrowException_Test()
|
public void DeletePosition_RecordNotFound_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var id = "nonexistent";
|
var id = Guid.NewGuid().ToString(); // Use a valid Guid to test not found scenario
|
||||||
_positionStorageContact.Setup(x => x.GetElementById(id)).Returns((PositionDataModel)null);
|
_positionStorageContact.Setup(x => x.GetElementById(id)).Returns((PositionDataModel)null);
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _positionBusinessLogicContract.DeletePosition(id),
|
Assert.That(() => _positionBusinessLogicContract.DeletePosition(id),
|
||||||
Throws.TypeOf<ElementNotFoundException>());
|
Throws.TypeOf<ElementNotFoundException>());
|
||||||
_positionStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
_positionStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -391,23 +391,31 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void DeletePosition_InvalidId_ThrowException_Test()
|
public void DeletePosition_InvalidId_ThrowException_Test()
|
||||||
{
|
{
|
||||||
|
// Arrange
|
||||||
|
var id = "invalid";
|
||||||
|
// No need to setup GetElementById for invalid ID since validation should be after existence check
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _positionBusinessLogicContract.DeletePosition("invalid"),
|
Assert.That(() => _positionBusinessLogicContract.DeletePosition(id),
|
||||||
Throws.TypeOf<ValidationException>());
|
Throws.TypeOf<ValidationException>());
|
||||||
_positionStorageContact.Verify(x => x.DeleteElement(It.IsAny<string>()), Times.Never);
|
_positionStorageContact.Verify(x => x.GetElementById(id), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DeletePosition_StorageThrowError_ThrowException_Test()
|
public void DeletePosition_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_positionStorageContact.Setup(x => x.DeleteElement(It.IsAny<string>()))
|
var id = Guid.NewGuid().ToString();
|
||||||
|
var position = new PositionDataModel(id, PositionType.Cool, "Baker");
|
||||||
|
_positionStorageContact.Setup(x => x.GetElementById(id)).Returns(position);
|
||||||
|
_positionStorageContact.Setup(x => x.DeleteElement(id))
|
||||||
.Throws(new StorageException(new InvalidOperationException()));
|
.Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _positionBusinessLogicContract.DeletePosition(Guid.NewGuid().ToString()),
|
Assert.That(() => _positionBusinessLogicContract.DeletePosition(id),
|
||||||
Throws.TypeOf<StorageException>());
|
Throws.TypeOf<StorageException>());
|
||||||
_positionStorageContact.Verify(x => x.DeleteElement(It.IsAny<string>()), Times.Once);
|
_positionStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
|
_positionStorageContact.Verify(x => x.DeleteElement(id), Times.Once);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -152,7 +152,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
Assert.That(elementById.IngredientsItems.Count > 0);
|
Assert.That(elementById.IngredientsItems.Count > 0);
|
||||||
Assert.That(elementById.OldName, Is.EqualTo("Cake"));
|
Assert.That(elementById.OldName, Is.EqualTo("Cake"));
|
||||||
Assert.That(elementById.OldDescription, Is.EqualTo("Delicious cake"));
|
Assert.That(elementById.OldDescription, Is.EqualTo("Delicious cake"));
|
||||||
_productStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
_productStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -239,7 +239,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void GetProductByData_NotFoundProduct_ThrowException_Test()
|
public void GetProductByData_NotFoundProduct_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var id = "nonexistent";
|
var id = Guid.NewGuid().ToString();
|
||||||
_productStorageContact.Setup(x => x.GetElementById(id)).Returns((ProductDataModel)null);
|
_productStorageContact.Setup(x => x.GetElementById(id)).Returns((ProductDataModel)null);
|
||||||
_productStorageContact.Setup(x => x.GetList()).Returns(new List<ProductDataModel>());
|
_productStorageContact.Setup(x => x.GetList()).Returns(new List<ProductDataModel>());
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
Assert.That(() => _productBusinessLogicContract.GetProductByData(id), Throws.TypeOf<ElementNotFoundException>());
|
Assert.That(() => _productBusinessLogicContract.GetProductByData(id), Throws.TypeOf<ElementNotFoundException>());
|
||||||
Assert.That(() => _productBusinessLogicContract.GetProductByData("NonExistentProduct"), Throws.TypeOf<ElementNotFoundException>());
|
Assert.That(() => _productBusinessLogicContract.GetProductByData("NonExistentProduct"), Throws.TypeOf<ElementNotFoundException>());
|
||||||
Assert.That(() => _productBusinessLogicContract.GetProductByData("OldNonExistent"), Throws.TypeOf<ElementNotFoundException>());
|
Assert.That(() => _productBusinessLogicContract.GetProductByData("OldNonExistent"), Throws.TypeOf<ElementNotFoundException>());
|
||||||
_productStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
_productStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
_productStorageContact.Verify(x => x.GetList(), Times.AtLeast(2));
|
_productStorageContact.Verify(x => x.GetList(), Times.AtLeast(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,17 +255,15 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void GetProductByData_StorageThrowError_ThrowException_Test()
|
public void GetProductByData_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_productStorageContact.Setup(x => x.GetElementById(It.IsAny<string>())).Throws(new StorageException(new InvalidOperationException()));
|
var id = Guid.NewGuid().ToString();
|
||||||
|
_productStorageContact.Setup(x => x.GetElementById(id)).Throws(new StorageException(new InvalidOperationException()));
|
||||||
_productStorageContact.Setup(x => x.GetList()).Throws(new StorageException(new InvalidOperationException()));
|
_productStorageContact.Setup(x => x.GetList()).Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _productBusinessLogicContract.GetProductByData(Guid.NewGuid().ToString()), Throws.TypeOf<StorageException>());
|
Assert.That(() => _productBusinessLogicContract.GetProductByData(id), Throws.TypeOf<StorageException>());
|
||||||
Assert.That(() => _productBusinessLogicContract.GetProductByData("Cake"), Throws.TypeOf<StorageException>());
|
_productStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
Assert.That(() => _productBusinessLogicContract.GetProductByData("OldCake"), Throws.TypeOf<StorageException>());
|
_productStorageContact.Verify(x => x.GetList(), Times.Never);
|
||||||
_productStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
|
||||||
_productStorageContact.Verify(x => x.GetList(), Times.AtLeast(2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void InsertProduct_CorrectRecord_Test()
|
public void InsertProduct_CorrectRecord_Test()
|
||||||
{
|
{
|
||||||
@ -313,19 +311,21 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void InsertProduct_RecordWithExistsData_ThrowException_Test()
|
public void InsertProduct_RecordWithExistsData_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
|
var ingredientId = Guid.NewGuid().ToString();
|
||||||
var product = new ProductDataModel(
|
var product = new ProductDataModel(
|
||||||
Guid.NewGuid().ToString(),
|
Guid.NewGuid().ToString(),
|
||||||
"Cake",
|
"Cake",
|
||||||
"Delicious cake",
|
"Delicious cake",
|
||||||
new List<IngredientDataModel>
|
new List<IngredientDataModel>
|
||||||
{
|
{
|
||||||
new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100)
|
new IngredientDataModel(ingredientId, "Sugar", "kg", 100)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
product.Name = "Updated Cake";
|
product.Name = "Updated Cake";
|
||||||
product.Description = "Updated delicious cake";
|
product.Description = "Updated delicious cake";
|
||||||
_productStorageContact.Setup(x => x.AddElement(It.IsAny<ProductDataModel>()))
|
_productStorageContact.Setup(x => x.AddElement(It.IsAny<ProductDataModel>()))
|
||||||
.Throws(new ElementExistsException("ID", product.Id));
|
.Throws(new ElementExistsException("ID", product.Id));
|
||||||
|
_ingredientStorageContact.Setup(x => x.GetElementById(ingredientId)).Returns(product.IngredientsItems[0]);
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _productBusinessLogicContract.InsertProduct(product), Throws.TypeOf<ElementExistsException>());
|
Assert.That(() => _productBusinessLogicContract.InsertProduct(product), Throws.TypeOf<ElementExistsException>());
|
||||||
@ -360,19 +360,21 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void InsertProduct_StorageThrowError_ThrowException_Test()
|
public void InsertProduct_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
|
var ingredientId = Guid.NewGuid().ToString();
|
||||||
var product = new ProductDataModel(
|
var product = new ProductDataModel(
|
||||||
Guid.NewGuid().ToString(),
|
Guid.NewGuid().ToString(),
|
||||||
"Cake",
|
"Cake",
|
||||||
"Delicious cake",
|
"Delicious cake",
|
||||||
new List<IngredientDataModel>
|
new List<IngredientDataModel>
|
||||||
{
|
{
|
||||||
new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100)
|
new IngredientDataModel(ingredientId, "Sugar", "kg", 100)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
product.Name = "Updated Cake";
|
product.Name = "Updated Cake";
|
||||||
product.Description = "Updated delicious cake";
|
product.Description = "Updated delicious cake";
|
||||||
_productStorageContact.Setup(x => x.AddElement(It.IsAny<ProductDataModel>()))
|
_productStorageContact.Setup(x => x.AddElement(It.IsAny<ProductDataModel>()))
|
||||||
.Throws(new StorageException(new InvalidOperationException()));
|
.Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
_ingredientStorageContact.Setup(x => x.GetElementById(ingredientId)).Returns(product.IngredientsItems[0]);
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _productBusinessLogicContract.InsertProduct(product), Throws.TypeOf<StorageException>());
|
Assert.That(() => _productBusinessLogicContract.InsertProduct(product), Throws.TypeOf<StorageException>());
|
||||||
@ -439,6 +441,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
product.Description = "Updated delicious cake";
|
product.Description = "Updated delicious cake";
|
||||||
_productStorageContact.Setup(x => x.UpdateElement(It.IsAny<ProductDataModel>()))
|
_productStorageContact.Setup(x => x.UpdateElement(It.IsAny<ProductDataModel>()))
|
||||||
.Throws(new ElementNotFoundException("Product not found"));
|
.Throws(new ElementNotFoundException("Product not found"));
|
||||||
|
_ingredientStorageContact.Setup(x => x.GetElementById(product.IngredientsItems[0].Id)).Returns(product.IngredientsItems[0]); // Mock ingredient existence
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _productBusinessLogicContract.UpdateProduct(product), Throws.TypeOf<ElementNotFoundException>());
|
Assert.That(() => _productBusinessLogicContract.UpdateProduct(product), Throws.TypeOf<ElementNotFoundException>());
|
||||||
@ -486,6 +489,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
product.Description = "Updated delicious cake";
|
product.Description = "Updated delicious cake";
|
||||||
_productStorageContact.Setup(x => x.UpdateElement(It.IsAny<ProductDataModel>()))
|
_productStorageContact.Setup(x => x.UpdateElement(It.IsAny<ProductDataModel>()))
|
||||||
.Throws(new StorageException(new InvalidOperationException()));
|
.Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
_ingredientStorageContact.Setup(x => x.GetElementById(product.IngredientsItems[0].Id)).Returns(product.IngredientsItems[0]); // Mock ingredient existence
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _productBusinessLogicContract.UpdateProduct(product), Throws.TypeOf<StorageException>());
|
Assert.That(() => _productBusinessLogicContract.UpdateProduct(product), Throws.TypeOf<StorageException>());
|
||||||
@ -533,40 +537,50 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
public void DeleteProduct_RecordNotFound_ThrowException_Test()
|
public void DeleteProduct_RecordNotFound_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var id = "nonexistent";
|
var id = Guid.NewGuid().ToString(); // Use a valid Guid
|
||||||
_productStorageContact.Setup(x => x.GetElementById(id)).Returns((ProductDataModel)null);
|
_productStorageContact.Setup(x => x.GetElementById(id)).Returns((ProductDataModel)null);
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _productBusinessLogicContract.DeleteProduct(id), Throws.TypeOf<ElementNotFoundException>());
|
Assert.That(() => _productBusinessLogicContract.DeleteProduct(id), Throws.TypeOf<ElementNotFoundException>());
|
||||||
_productStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
_productStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void DeleteProduct_NullOrEmptyId_ThrowException_Test()
|
|
||||||
{
|
|
||||||
// Act & Assert
|
|
||||||
Assert.That(() => _productBusinessLogicContract.DeleteProduct(null), Throws.TypeOf<ArgumentNullException>());
|
|
||||||
Assert.That(() => _productBusinessLogicContract.DeleteProduct(string.Empty), Throws.TypeOf<ArgumentNullException>());
|
|
||||||
_productStorageContact.Verify(x => x.DeleteElement(It.IsAny<string>()), Times.Never);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DeleteProduct_InvalidId_ThrowException_Test()
|
public void DeleteProduct_InvalidId_ThrowException_Test()
|
||||||
{
|
{
|
||||||
|
// Arrange
|
||||||
|
var id = "invalid";
|
||||||
|
// No need to setup GetElementById for invalid ID since validation should occur first
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _productBusinessLogicContract.DeleteProduct("invalid"), Throws.TypeOf<ValidationException>());
|
Assert.That(() => _productBusinessLogicContract.DeleteProduct(id), Throws.TypeOf<ValidationException>());
|
||||||
_productStorageContact.Verify(x => x.DeleteElement(It.IsAny<string>()), Times.Never);
|
_productStorageContact.Verify(x => x.GetElementById(id), Times.Never); // Should not call GetElementById for invalid GUID
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DeleteProduct_StorageThrowError_ThrowException_Test()
|
public void DeleteProduct_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_productStorageContact.Setup(x => x.DeleteElement(It.IsAny<string>())).Throws(new StorageException(new InvalidOperationException()));
|
var id = Guid.NewGuid().ToString();
|
||||||
|
var product = new ProductDataModel(
|
||||||
|
id,
|
||||||
|
"Cake",
|
||||||
|
"Delicious cake",
|
||||||
|
new List<IngredientDataModel>
|
||||||
|
{
|
||||||
|
new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 100)
|
||||||
|
}
|
||||||
|
);
|
||||||
|
product.Name = "Updated Cake";
|
||||||
|
product.Description = "Updated delicious cake";
|
||||||
|
_productStorageContact.Setup(x => x.GetElementById(id)).Returns(product);
|
||||||
|
_productStorageContact.Setup(x => x.DeleteElement(id))
|
||||||
|
.Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _productBusinessLogicContract.DeleteProduct(Guid.NewGuid().ToString()), Throws.TypeOf<StorageException>());
|
Assert.That(() => _productBusinessLogicContract.DeleteProduct(id), Throws.TypeOf<StorageException>());
|
||||||
_productStorageContact.Verify(x => x.DeleteElement(It.IsAny<string>()), Times.Once);
|
_productStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
|
_productStorageContact.Verify(x => x.DeleteElement(id), Times.Once);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -40,7 +40,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetList_ReturnsListOfRecords_Test()
|
public void GetAllSalaries_ReturnsListOfRecords_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var pekarId = Guid.NewGuid().ToString();
|
var pekarId = Guid.NewGuid().ToString();
|
||||||
@ -67,22 +67,23 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
_pekarStorageContact.Setup(x => x.GetElementById(pekarId)).Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
_pekarStorageContact.Setup(x => x.GetElementById(pekarId)).Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var list = _salaryBusinessLogicContract.GetList();
|
var list = _salaryBusinessLogicContract.GetAllSalaries();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.That(list, Is.Not.Null);
|
Assert.That(list, Is.Not.Null);
|
||||||
Assert.That(list, Is.EquivalentTo(salaries));
|
Assert.That(list, Is.EquivalentTo(salaries));
|
||||||
Assert.That(list.All(s => Guid.TryParse(s.Id, out _) && Guid.TryParse(s.PekarId, out _) && s.BaseRate >= 0 && s.BonusRate >= 0 && s.TotalSalary >= 0), Is.True);
|
Assert.That(list.All(s => Guid.TryParse(s.Id, out _) && Guid.TryParse(s.PekarId, out _) && s.BaseRate >= 0 && s.BonusRate >= 0 && s.TotalSalary >= 0), Is.True);
|
||||||
|
_salaryStorageContact.Verify(x => x.GetList(), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetList_ReturnsEmptyList_Test()
|
public void GetAllSalaries_ReturnsEmptyList_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_salaryStorageContact.Setup(x => x.GetList()).Returns(new List<SalaryDataModel>());
|
_salaryStorageContact.Setup(x => x.GetList()).Returns(new List<SalaryDataModel>());
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var list = _salaryBusinessLogicContract.GetList();
|
var list = _salaryBusinessLogicContract.GetAllSalaries();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.That(list, Is.Not.Null);
|
Assert.That(list, Is.Not.Null);
|
||||||
@ -91,29 +92,29 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetList_ReturnsNull_ThrowException_Test()
|
public void GetAllSalaries_ReturnsNull_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_salaryStorageContact.Setup(x => x.GetList()).Returns((List<SalaryDataModel>)null);
|
_salaryStorageContact.Setup(x => x.GetList()).Returns((List<SalaryDataModel>)null);
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _salaryBusinessLogicContract.GetList(), Throws.TypeOf<NullListException>());
|
Assert.That(() => _salaryBusinessLogicContract.GetAllSalaries(), Throws.TypeOf<NullListException>());
|
||||||
_salaryStorageContact.Verify(x => x.GetList(), Times.Once);
|
_salaryStorageContact.Verify(x => x.GetList(), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetList_StorageThrowError_ThrowException_Test()
|
public void GetAllSalaries_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_salaryStorageContact.Setup(x => x.GetList()).Throws(new StorageException(new InvalidOperationException()));
|
_salaryStorageContact.Setup(x => x.GetList()).Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _salaryBusinessLogicContract.GetList(), Throws.TypeOf<StorageException>());
|
Assert.That(() => _salaryBusinessLogicContract.GetAllSalaries(), Throws.TypeOf<StorageException>());
|
||||||
_salaryStorageContact.Verify(x => x.GetList(), Times.Once);
|
_salaryStorageContact.Verify(x => x.GetList(), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetElementById_ReturnsSalaryById_Test()
|
public void GetSalaryByData_ReturnsSalaryById_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var id = Guid.NewGuid().ToString();
|
var id = Guid.NewGuid().ToString();
|
||||||
@ -130,7 +131,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
_pekarStorageContact.Setup(x => x.GetElementById(pekarId)).Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
_pekarStorageContact.Setup(x => x.GetElementById(pekarId)).Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var element = _salaryBusinessLogicContract.GetElementById(id);
|
var element = _salaryBusinessLogicContract.GetSalaryByData(id);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.That(element, Is.Not.Null);
|
Assert.That(element, Is.Not.Null);
|
||||||
@ -140,43 +141,71 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
Assert.That(element.BaseRate >= 0);
|
Assert.That(element.BaseRate >= 0);
|
||||||
Assert.That(element.BonusRate >= 0);
|
Assert.That(element.BonusRate >= 0);
|
||||||
Assert.That(element.TotalSalary >= 0);
|
Assert.That(element.TotalSalary >= 0);
|
||||||
_salaryStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
_salaryStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
|
_pekarStorageContact.Verify(x => x.GetElementById(pekarId), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetElementById_EmptyId_ThrowException_Test()
|
public void GetSalaryByData_EmptyId_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _salaryBusinessLogicContract.GetElementById(null), Throws.TypeOf<ArgumentNullException>());
|
Assert.That(() => _salaryBusinessLogicContract.GetSalaryByData(null), Throws.TypeOf<ArgumentNullException>());
|
||||||
Assert.That(() => _salaryBusinessLogicContract.GetElementById(string.Empty), Throws.TypeOf<ArgumentNullException>());
|
Assert.That(() => _salaryBusinessLogicContract.GetSalaryByData(string.Empty), Throws.TypeOf<ArgumentNullException>());
|
||||||
_salaryStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Never);
|
_salaryStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetElementById_NotFoundSalary_ThrowException_Test()
|
public void GetSalaryByData_InvalidId_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var id = "nonexistent";
|
var id = "invalid";
|
||||||
_salaryStorageContact.Setup(x => x.GetElementById(id)).Returns((SalaryDataModel)null);
|
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _salaryBusinessLogicContract.GetElementById(id), Throws.TypeOf<ElementNotFoundException>());
|
Assert.That(() => _salaryBusinessLogicContract.GetSalaryByData(id), Throws.TypeOf<ValidationException>());
|
||||||
_salaryStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
_salaryStorageContact.Verify(x => x.GetElementById(id), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetElementById_StorageThrowError_ThrowException_Test()
|
public void GetSalaryByData_NotFoundSalary_ThrowException_Test()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var id = Guid.NewGuid().ToString();
|
||||||
|
_salaryStorageContact.Setup(x => x.GetElementById(id)).Returns((SalaryDataModel)null);
|
||||||
|
|
||||||
|
// Act & Assert
|
||||||
|
Assert.That(() => _salaryBusinessLogicContract.GetSalaryByData(id), Throws.TypeOf<ElementNotFoundException>());
|
||||||
|
_salaryStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetSalaryByData_PekarNotFound_ThrowException_Test()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var id = Guid.NewGuid().ToString();
|
||||||
|
var pekarId = Guid.NewGuid().ToString();
|
||||||
|
var salary = new SalaryDataModel(id, pekarId, DateTime.Now, 1000.00m, 200.00m, 1200.00m);
|
||||||
|
_salaryStorageContact.Setup(x => x.GetElementById(id)).Returns(salary);
|
||||||
|
_pekarStorageContact.Setup(x => x.GetElementById(pekarId)).Returns((PekarDataModel)null);
|
||||||
|
|
||||||
|
// Act & Assert
|
||||||
|
Assert.That(() => _salaryBusinessLogicContract.GetSalaryByData(id), Throws.TypeOf<ElementNotFoundException>());
|
||||||
|
_salaryStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
|
_pekarStorageContact.Verify(x => x.GetElementById(pekarId), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void GetSalaryByData_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_salaryStorageContact.Setup(x => x.GetElementById(It.IsAny<string>())).Throws(new StorageException(new InvalidOperationException()));
|
_salaryStorageContact.Setup(x => x.GetElementById(It.IsAny<string>())).Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _salaryBusinessLogicContract.GetElementById(Guid.NewGuid().ToString()), Throws.TypeOf<StorageException>());
|
Assert.That(() => _salaryBusinessLogicContract.GetSalaryByData(Guid.NewGuid().ToString()), Throws.TypeOf<StorageException>());
|
||||||
_salaryStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
_salaryStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void AddElement_CorrectRecord_Test()
|
public void InsertSalary_CorrectRecord_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var pekarId = Guid.NewGuid().ToString();
|
var pekarId = Guid.NewGuid().ToString();
|
||||||
@ -198,7 +227,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
_pekarStorageContact.Setup(x => x.GetElementById(pekarId)).Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
_pekarStorageContact.Setup(x => x.GetElementById(pekarId)).Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
_salaryBusinessLogicContract.AddElement(salary);
|
_salaryBusinessLogicContract.InsertSalary(salary);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
_salaryStorageContact.Verify(x => x.AddElement(It.IsAny<SalaryDataModel>()), Times.Once);
|
_salaryStorageContact.Verify(x => x.AddElement(It.IsAny<SalaryDataModel>()), Times.Once);
|
||||||
@ -208,10 +237,31 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
Assert.That(salary.BaseRate >= 0);
|
Assert.That(salary.BaseRate >= 0);
|
||||||
Assert.That(salary.BonusRate >= 0);
|
Assert.That(salary.BonusRate >= 0);
|
||||||
Assert.That(salary.TotalSalary >= 0);
|
Assert.That(salary.TotalSalary >= 0);
|
||||||
|
_pekarStorageContact.Verify(x => x.GetElementById(pekarId), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void AddElement_RecordWithExistsData_ThrowException_Test()
|
public void InsertSalary_PekarNotFound_ThrowException_Test()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var salary = new SalaryDataModel(
|
||||||
|
Guid.NewGuid().ToString(),
|
||||||
|
Guid.NewGuid().ToString(),
|
||||||
|
DateTime.Now,
|
||||||
|
1000.00m,
|
||||||
|
200.00m,
|
||||||
|
1200.00m
|
||||||
|
);
|
||||||
|
_pekarStorageContact.Setup(x => x.GetElementById(salary.PekarId)).Returns((PekarDataModel)null);
|
||||||
|
|
||||||
|
// Act & Assert
|
||||||
|
Assert.That(() => _salaryBusinessLogicContract.InsertSalary(salary), Throws.TypeOf<ElementNotFoundException>());
|
||||||
|
_salaryStorageContact.Verify(x => x.AddElement(It.IsAny<SalaryDataModel>()), Times.Never);
|
||||||
|
_pekarStorageContact.Verify(x => x.GetElementById(salary.PekarId), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void InsertSalary_RecordWithExistsData_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var salary = new SalaryDataModel(
|
var salary = new SalaryDataModel(
|
||||||
@ -223,25 +273,28 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
1200.00m
|
1200.00m
|
||||||
);
|
);
|
||||||
_salaryStorageContact.Setup(x => x.AddElement(It.IsAny<SalaryDataModel>())).Throws(new ElementExistsException("ID", salary.Id));
|
_salaryStorageContact.Setup(x => x.AddElement(It.IsAny<SalaryDataModel>())).Throws(new ElementExistsException("ID", salary.Id));
|
||||||
|
_pekarStorageContact.Setup(x => x.GetElementById(salary.PekarId)).Returns(new PekarDataModel(salary.PekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _salaryBusinessLogicContract.AddElement(salary), Throws.TypeOf<ElementExistsException>());
|
Assert.That(() => _salaryBusinessLogicContract.InsertSalary(salary), Throws.TypeOf<ElementExistsException>());
|
||||||
_salaryStorageContact.Verify(x => x.AddElement(It.IsAny<SalaryDataModel>()), Times.Once);
|
_salaryStorageContact.Verify(x => x.AddElement(It.IsAny<SalaryDataModel>()), Times.Once);
|
||||||
|
_pekarStorageContact.Verify(x => x.GetElementById(salary.PekarId), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void AddElement_NullRecord_ThrowException_Test()
|
public void InsertSalary_NullRecord_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _salaryBusinessLogicContract.AddElement(null), Throws.TypeOf<ArgumentNullException>());
|
Assert.That(() => _salaryBusinessLogicContract.InsertSalary(null), Throws.TypeOf<ArgumentNullException>());
|
||||||
_salaryStorageContact.Verify(x => x.AddElement(It.IsAny<SalaryDataModel>()), Times.Never);
|
_salaryStorageContact.Verify(x => x.AddElement(It.IsAny<SalaryDataModel>()), Times.Never);
|
||||||
|
_pekarStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void AddElement_InvalidRecord_ThrowException_Test()
|
public void InsertSalary_InvalidRecord_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _salaryBusinessLogicContract.AddElement(new SalaryDataModel(
|
Assert.That(() => _salaryBusinessLogicContract.InsertSalary(new SalaryDataModel(
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
DateTime.Now,
|
DateTime.Now,
|
||||||
@ -250,10 +303,11 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
-1200.00m
|
-1200.00m
|
||||||
)), Throws.TypeOf<ValidationException>());
|
)), Throws.TypeOf<ValidationException>());
|
||||||
_salaryStorageContact.Verify(x => x.AddElement(It.IsAny<SalaryDataModel>()), Times.Never);
|
_salaryStorageContact.Verify(x => x.AddElement(It.IsAny<SalaryDataModel>()), Times.Never);
|
||||||
|
_pekarStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void AddElement_StorageThrowError_ThrowException_Test()
|
public void InsertSalary_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var salary = new SalaryDataModel(
|
var salary = new SalaryDataModel(
|
||||||
@ -265,14 +319,16 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
1200.00m
|
1200.00m
|
||||||
);
|
);
|
||||||
_salaryStorageContact.Setup(x => x.AddElement(It.IsAny<SalaryDataModel>())).Throws(new StorageException(new InvalidOperationException()));
|
_salaryStorageContact.Setup(x => x.AddElement(It.IsAny<SalaryDataModel>())).Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
_pekarStorageContact.Setup(x => x.GetElementById(salary.PekarId)).Returns(new PekarDataModel(salary.PekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _salaryBusinessLogicContract.AddElement(salary), Throws.TypeOf<StorageException>());
|
Assert.That(() => _salaryBusinessLogicContract.InsertSalary(salary), Throws.TypeOf<StorageException>());
|
||||||
_salaryStorageContact.Verify(x => x.AddElement(It.IsAny<SalaryDataModel>()), Times.Once);
|
_salaryStorageContact.Verify(x => x.AddElement(It.IsAny<SalaryDataModel>()), Times.Once);
|
||||||
|
_pekarStorageContact.Verify(x => x.GetElementById(salary.PekarId), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void UpdateElement_CorrectRecord_Test()
|
public void UpdateSalary_CorrectRecord_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var pekarId = Guid.NewGuid().ToString();
|
var pekarId = Guid.NewGuid().ToString();
|
||||||
@ -294,7 +350,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
_pekarStorageContact.Setup(x => x.GetElementById(pekarId)).Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
_pekarStorageContact.Setup(x => x.GetElementById(pekarId)).Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
_salaryBusinessLogicContract.UpdateElement(salary);
|
_salaryBusinessLogicContract.UpdateSalary(salary);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
_salaryStorageContact.Verify(x => x.UpdateElement(It.IsAny<SalaryDataModel>()), Times.Once);
|
_salaryStorageContact.Verify(x => x.UpdateElement(It.IsAny<SalaryDataModel>()), Times.Once);
|
||||||
@ -304,10 +360,31 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
Assert.That(salary.BaseRate >= 0);
|
Assert.That(salary.BaseRate >= 0);
|
||||||
Assert.That(salary.BonusRate >= 0);
|
Assert.That(salary.BonusRate >= 0);
|
||||||
Assert.That(salary.TotalSalary >= 0);
|
Assert.That(salary.TotalSalary >= 0);
|
||||||
|
_pekarStorageContact.Verify(x => x.GetElementById(pekarId), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void UpdateElement_RecordNotFound_ThrowException_Test()
|
public void UpdateSalary_PekarNotFound_ThrowException_Test()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var salary = new SalaryDataModel(
|
||||||
|
Guid.NewGuid().ToString(),
|
||||||
|
Guid.NewGuid().ToString(),
|
||||||
|
DateTime.Now,
|
||||||
|
1000.00m,
|
||||||
|
200.00m,
|
||||||
|
1200.00m
|
||||||
|
);
|
||||||
|
_pekarStorageContact.Setup(x => x.GetElementById(salary.PekarId)).Returns((PekarDataModel)null);
|
||||||
|
|
||||||
|
// Act & Assert
|
||||||
|
Assert.That(() => _salaryBusinessLogicContract.UpdateSalary(salary), Throws.TypeOf<ElementNotFoundException>());
|
||||||
|
_salaryStorageContact.Verify(x => x.UpdateElement(It.IsAny<SalaryDataModel>()), Times.Never);
|
||||||
|
_pekarStorageContact.Verify(x => x.GetElementById(salary.PekarId), Times.Once);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void UpdateSalary_RecordNotFound_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var salary = new SalaryDataModel(
|
var salary = new SalaryDataModel(
|
||||||
@ -319,25 +396,28 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
1200.00m
|
1200.00m
|
||||||
);
|
);
|
||||||
_salaryStorageContact.Setup(x => x.UpdateElement(It.IsAny<SalaryDataModel>())).Throws(new ElementNotFoundException("Salary not found"));
|
_salaryStorageContact.Setup(x => x.UpdateElement(It.IsAny<SalaryDataModel>())).Throws(new ElementNotFoundException("Salary not found"));
|
||||||
|
_pekarStorageContact.Setup(x => x.GetElementById(salary.PekarId)).Returns(new PekarDataModel(salary.PekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _salaryBusinessLogicContract.UpdateElement(salary), Throws.TypeOf<ElementNotFoundException>());
|
Assert.That(() => _salaryBusinessLogicContract.UpdateSalary(salary), Throws.TypeOf<ElementNotFoundException>());
|
||||||
_salaryStorageContact.Verify(x => x.UpdateElement(It.IsAny<SalaryDataModel>()), Times.Once);
|
_salaryStorageContact.Verify(x => x.UpdateElement(It.IsAny<SalaryDataModel>()), Times.Once);
|
||||||
|
_pekarStorageContact.Verify(x => x.GetElementById(salary.PekarId), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void UpdateElement_NullRecord_ThrowException_Test()
|
public void UpdateSalary_NullRecord_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _salaryBusinessLogicContract.UpdateElement(null), Throws.TypeOf<ArgumentNullException>());
|
Assert.That(() => _salaryBusinessLogicContract.UpdateSalary(null), Throws.TypeOf<ArgumentNullException>());
|
||||||
_salaryStorageContact.Verify(x => x.UpdateElement(It.IsAny<SalaryDataModel>()), Times.Never);
|
_salaryStorageContact.Verify(x => x.UpdateElement(It.IsAny<SalaryDataModel>()), Times.Never);
|
||||||
|
_pekarStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void UpdateElement_InvalidRecord_ThrowException_Test()
|
public void UpdateSalary_InvalidRecord_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _salaryBusinessLogicContract.UpdateElement(new SalaryDataModel(
|
Assert.That(() => _salaryBusinessLogicContract.UpdateSalary(new SalaryDataModel(
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
DateTime.Now,
|
DateTime.Now,
|
||||||
@ -346,10 +426,11 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
-1200.00m
|
-1200.00m
|
||||||
)), Throws.TypeOf<ValidationException>());
|
)), Throws.TypeOf<ValidationException>());
|
||||||
_salaryStorageContact.Verify(x => x.UpdateElement(It.IsAny<SalaryDataModel>()), Times.Never);
|
_salaryStorageContact.Verify(x => x.UpdateElement(It.IsAny<SalaryDataModel>()), Times.Never);
|
||||||
|
_pekarStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void UpdateElement_StorageThrowError_ThrowException_Test()
|
public void UpdateSalary_StorageThrowError_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var salary = new SalaryDataModel(
|
var salary = new SalaryDataModel(
|
||||||
@ -361,14 +442,16 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
1200.00m
|
1200.00m
|
||||||
);
|
);
|
||||||
_salaryStorageContact.Setup(x => x.UpdateElement(It.IsAny<SalaryDataModel>())).Throws(new StorageException(new InvalidOperationException()));
|
_salaryStorageContact.Setup(x => x.UpdateElement(It.IsAny<SalaryDataModel>())).Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
_pekarStorageContact.Setup(x => x.GetElementById(salary.PekarId)).Returns(new PekarDataModel(salary.PekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _salaryBusinessLogicContract.UpdateElement(salary), Throws.TypeOf<StorageException>());
|
Assert.That(() => _salaryBusinessLogicContract.UpdateSalary(salary), Throws.TypeOf<StorageException>());
|
||||||
_salaryStorageContact.Verify(x => x.UpdateElement(It.IsAny<SalaryDataModel>()), Times.Once);
|
_salaryStorageContact.Verify(x => x.UpdateElement(It.IsAny<SalaryDataModel>()), Times.Once);
|
||||||
|
_pekarStorageContact.Verify(x => x.GetElementById(salary.PekarId), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DeleteElement_CorrectId_Test()
|
public void DeleteSalary_CorrectId_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var id = Guid.NewGuid().ToString();
|
var id = Guid.NewGuid().ToString();
|
||||||
@ -387,7 +470,7 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
_pekarStorageContact.Setup(x => x.GetElementById(pekarId)).Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
_pekarStorageContact.Setup(x => x.GetElementById(pekarId)).Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
_salaryBusinessLogicContract.DeleteElement(id);
|
_salaryBusinessLogicContract.DeleteSalary(id);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
_salaryStorageContact.Verify(x => x.DeleteElement(id), Times.Once);
|
_salaryStorageContact.Verify(x => x.DeleteElement(id), Times.Once);
|
||||||
@ -400,43 +483,53 @@ namespace CandyHouseTests.BusinessLogicsContractsTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DeleteElement_RecordNotFound_ThrowException_Test()
|
public void DeleteSalary_RecordNotFound_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var id = "nonexistent";
|
var id = Guid.NewGuid().ToString();
|
||||||
_salaryStorageContact.Setup(x => x.GetElementById(id)).Returns((SalaryDataModel)null);
|
_salaryStorageContact.Setup(x => x.GetElementById(id)).Returns((SalaryDataModel)null);
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _salaryBusinessLogicContract.DeleteElement(id), Throws.TypeOf<ElementNotFoundException>());
|
Assert.That(() => _salaryBusinessLogicContract.DeleteSalary(id), Throws.TypeOf<ElementNotFoundException>());
|
||||||
_salaryStorageContact.Verify(x => x.GetElementById(It.IsAny<string>()), Times.Once);
|
_salaryStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DeleteElement_NullOrEmptyId_ThrowException_Test()
|
public void DeleteSalary_NullOrEmptyId_ThrowException_Test()
|
||||||
{
|
{
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _salaryBusinessLogicContract.DeleteElement(null), Throws.TypeOf<ArgumentNullException>());
|
Assert.That(() => _salaryBusinessLogicContract.DeleteSalary(null), Throws.TypeOf<ArgumentNullException>());
|
||||||
Assert.That(() => _salaryBusinessLogicContract.DeleteElement(string.Empty), Throws.TypeOf<ArgumentNullException>());
|
Assert.That(() => _salaryBusinessLogicContract.DeleteSalary(string.Empty), Throws.TypeOf<ArgumentNullException>());
|
||||||
_salaryStorageContact.Verify(x => x.DeleteElement(It.IsAny<string>()), Times.Never);
|
_salaryStorageContact.Verify(x => x.DeleteElement(It.IsAny<string>()), Times.Never);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void DeleteElement_InvalidId_ThrowException_Test()
|
public void DeleteSalary_InvalidId_ThrowException_Test()
|
||||||
{
|
|
||||||
// Act & Assert
|
|
||||||
Assert.That(() => _salaryBusinessLogicContract.DeleteElement("invalid"), Throws.TypeOf<ValidationException>());
|
|
||||||
_salaryStorageContact.Verify(x => x.DeleteElement(It.IsAny<string>()), Times.Never);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void DeleteElement_StorageThrowError_ThrowException_Test()
|
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
_salaryStorageContact.Setup(x => x.DeleteElement(It.IsAny<string>())).Throws(new StorageException(new InvalidOperationException()));
|
var id = "invalid";
|
||||||
|
|
||||||
// Act & Assert
|
// Act & Assert
|
||||||
Assert.That(() => _salaryBusinessLogicContract.DeleteElement(Guid.NewGuid().ToString()), Throws.TypeOf<StorageException>());
|
Assert.That(() => _salaryBusinessLogicContract.DeleteSalary(id), Throws.TypeOf<ValidationException>());
|
||||||
_salaryStorageContact.Verify(x => x.DeleteElement(It.IsAny<string>()), Times.Once);
|
_salaryStorageContact.Verify(x => x.DeleteElement(id), Times.Never);
|
||||||
|
_salaryStorageContact.Verify(x => x.GetElementById(id), Times.Never);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void DeleteSalary_StorageThrowError_ThrowException_Test()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var id = Guid.NewGuid().ToString();
|
||||||
|
var pekarId = Guid.NewGuid().ToString();
|
||||||
|
var salary = new SalaryDataModel(id, pekarId, DateTime.Now, 1000.00m, 200.00m, 1200.00m);
|
||||||
|
_salaryStorageContact.Setup(x => x.GetElementById(id)).Returns(salary);
|
||||||
|
_salaryStorageContact.Setup(x => x.DeleteElement(id)).Throws(new StorageException(new InvalidOperationException()));
|
||||||
|
_pekarStorageContact.Setup(x => x.GetElementById(pekarId)).Returns(new PekarDataModel(pekarId, "Ivan Ivanov", "Baker", 1.5m, new List<ProductDataModel>()));
|
||||||
|
|
||||||
|
// Act & Assert
|
||||||
|
Assert.That(() => _salaryBusinessLogicContract.DeleteSalary(id), Throws.TypeOf<StorageException>());
|
||||||
|
_salaryStorageContact.Verify(x => x.GetElementById(id), Times.Once);
|
||||||
|
_salaryStorageContact.Verify(x => x.DeleteElement(id), Times.Once);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="8.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="..\packages\NUnit3TestAdapter.5.0.0\build\net462\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.5.0.0\build\net462\NUnit3TestAdapter.props')" />
|
<Import Project="..\packages\NUnit3TestAdapter.5.0.0\build\net462\NUnit3TestAdapter.props" Condition="Exists('..\packages\NUnit3TestAdapter.5.0.0\build\net462\NUnit3TestAdapter.props')" />
|
||||||
<Import Project="..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.3\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props" Condition="Exists('..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.3\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props')" />
|
<Import Project="..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.3\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props" Condition="Exists('..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.3\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props')" />
|
||||||
<Import Project="..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\build\Microsoft.Testing.Platform.MSBuild.props" Condition="Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\build\Microsoft.Testing.Platform.MSBuild.props')" />
|
<Import Project="..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\build\Microsoft.Testing.Platform.MSBuild.props" Condition="Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\build\Microsoft.Testing.Platform.MSBuild.props')" />
|
||||||
@ -39,96 +39,108 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Castle.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
<Reference Include="Castle.Core, Version=5.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll</HintPath>
|
<HintPath>..\packages\Castle.Core.5.1.1\lib\net462\Castle.Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.ApplicationInsights, Version=2.22.0.997, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.ApplicationInsights, Version=2.22.0.997, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.ApplicationInsights.2.22.0\lib\net46\Microsoft.ApplicationInsights.dll</HintPath>
|
<HintPath>..\packages\Microsoft.ApplicationInsights.2.22.0\lib\net46\Microsoft.ApplicationInsights.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.DependencyInjection.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.DependencyInjection.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.Logging, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.Logging, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Extensions.Logging.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.Logging.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Extensions.Logging.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.Logging.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.Options, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.Options, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Extensions.Options.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.Options.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Extensions.Options.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.Options.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Extensions.Primitives, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Extensions.Primitives, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Extensions.Primitives.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Extensions.Primitives.10.0.0-preview.1.25080.5\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Testing.Extensions.MSBuild, Version=1.5.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Testing.Extensions.MSBuild, Version=1.5.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\lib\netstandard2.0\Microsoft.Testing.Extensions.MSBuild.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\lib\netstandard2.0\Microsoft.Testing.Extensions.MSBuild.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Testing.Extensions.Telemetry, Version=1.5.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Testing.Extensions.Telemetry, Version=1.5.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.3\lib\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.3\lib\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Testing.Extensions.TrxReport.Abstractions, Version=1.5.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Testing.Extensions.TrxReport.Abstractions, Version=1.5.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Testing.Extensions.TrxReport.Abstractions.1.5.3\lib\netstandard2.0\Microsoft.Testing.Extensions.TrxReport.Abstractions.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Testing.Extensions.TrxReport.Abstractions.1.5.3\lib\netstandard2.0\Microsoft.Testing.Extensions.TrxReport.Abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Testing.Extensions.VSTestBridge, Version=1.5.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Testing.Extensions.VSTestBridge, Version=1.5.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Testing.Extensions.VSTestBridge.1.5.3\lib\netstandard2.0\Microsoft.Testing.Extensions.VSTestBridge.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Testing.Extensions.VSTestBridge.1.5.3\lib\netstandard2.0\Microsoft.Testing.Extensions.VSTestBridge.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.Testing.Platform, Version=1.5.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.Testing.Platform, Version=1.5.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.Testing.Platform.1.5.3\lib\netstandard2.0\Microsoft.Testing.Platform.dll</HintPath>
|
<HintPath>..\packages\Microsoft.Testing.Platform.1.5.3\lib\netstandard2.0\Microsoft.Testing.Platform.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.TestPlatform.CoreUtilities, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.TestPlatform.CoreUtilities, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.TestPlatform.ObjectModel.17.12.0\lib\net462\Microsoft.TestPlatform.CoreUtilities.dll</HintPath>
|
<HintPath>..\packages\Microsoft.TestPlatform.ObjectModel.17.12.0\lib\net462\Microsoft.TestPlatform.CoreUtilities.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.TestPlatform.PlatformAbstractions, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.TestPlatform.PlatformAbstractions, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.TestPlatform.ObjectModel.17.12.0\lib\net462\Microsoft.TestPlatform.PlatformAbstractions.dll</HintPath>
|
<HintPath>..\packages\Microsoft.TestPlatform.ObjectModel.17.12.0\lib\net462\Microsoft.TestPlatform.PlatformAbstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.TestPlatform.ObjectModel.17.12.0\lib\net462\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll</HintPath>
|
<HintPath>..\packages\Microsoft.TestPlatform.ObjectModel.17.12.0\lib\net462\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Moq, Version=4.20.72.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
<Reference Include="Moq, Version=4.20.72.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Moq.4.20.72\lib\net462\Moq.dll</HintPath>
|
<HintPath>..\packages\Moq.4.20.72\lib\net462\Moq.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="mscorlib" />
|
<Reference Include="mscorlib" />
|
||||||
|
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Buffers, Version=4.0.4.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
|
<HintPath>..\packages\System.Buffers.4.6.0\lib\net462\System.Buffers.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath>
|
<HintPath>..\packages\System.Collections.Immutable.1.5.0\lib\netstandard2.0\System.Collections.Immutable.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Diagnostics.DiagnosticSource, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Diagnostics.DiagnosticSource, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.10.0.0-preview.1.25080.5\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.10.0.0-preview.1.25080.5\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.IO.Pipelines, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.IO.Pipelines.10.0.0-preview.1.25080.5\lib\net462\System.IO.Pipelines.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Memory, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Memory, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll</HintPath>
|
<HintPath>..\packages\System.Memory.4.6.0\lib\net462\System.Memory.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="System.Numerics" />
|
<Reference Include="System.Numerics" />
|
||||||
<Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Numerics.Vectors, Version=4.1.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
|
<HintPath>..\packages\System.Numerics.Vectors.4.6.0\lib\net462\System.Numerics.Vectors.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Reflection.Metadata, Version=1.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Reflection.Metadata, Version=1.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Reflection.Metadata.1.6.0\lib\netstandard2.0\System.Reflection.Metadata.dll</HintPath>
|
<HintPath>..\packages\System.Reflection.Metadata.1.6.0\lib\netstandard2.0\System.Reflection.Metadata.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Runtime" />
|
<Reference Include="System.Runtime" />
|
||||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.1.0\lib\net462\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Runtime.Serialization" />
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
|
<Reference Include="System.Text.Encodings.Web, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Text.Encodings.Web.10.0.0-preview.1.25080.5\lib\net462\System.Text.Encodings.Web.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="System.Text.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\packages\System.Text.Json.10.0.0-preview.1.25080.5\lib\net462\System.Text.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.6.0\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
|
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.6.0\lib\net462\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="nunit.framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb">
|
<Reference Include="nunit.framework, Version=3.5.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb">
|
||||||
@ -152,29 +164,29 @@
|
|||||||
<Compile Include="DataModelsTests\SalaryDataModelTests.cs" />
|
<Compile Include="DataModelsTests\SalaryDataModelTests.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\CandyHouseBase\CandyHouseBase.csproj">
|
<ProjectReference Include="..\CandyHouseBase\CandyHouseBase.csproj">
|
||||||
<Project>{5df70b46-31f7-4d15-8c60-52c0a0a364f0}</Project>
|
<Project>{5df70b46-31f7-4d15-8c60-52c0a0a364f0}</Project>
|
||||||
<Name>CandyHouseBase</Name>
|
<Name>CandyHouseBase</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="ILLink\ILLink.Descriptors.LibraryBuild.xml" />
|
<Content Include="ILLink\ILLink.Descriptors.LibraryBuild.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\Microsoft.Testing.Platform.1.5.3\build\netstandard2.0\Microsoft.Testing.Platform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Platform.1.5.3\build\netstandard2.0\Microsoft.Testing.Platform.props'))" />
|
<Error Condition="!Exists('..\packages\Microsoft.Testing.Platform.1.5.3\build\netstandard2.0\Microsoft.Testing.Platform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Platform.1.5.3\build\netstandard2.0\Microsoft.Testing.Platform.props'))" />
|
||||||
<Error Condition="!Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\build\Microsoft.Testing.Platform.MSBuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\build\Microsoft.Testing.Platform.MSBuild.props'))" />
|
<Error Condition="!Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\build\Microsoft.Testing.Platform.MSBuild.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\build\Microsoft.Testing.Platform.MSBuild.props'))" />
|
||||||
<Error Condition="!Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\build\Microsoft.Testing.Platform.MSBuild.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\build\Microsoft.Testing.Platform.MSBuild.targets'))" />
|
<Error Condition="!Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\build\Microsoft.Testing.Platform.MSBuild.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\build\Microsoft.Testing.Platform.MSBuild.targets'))" />
|
||||||
<Error Condition="!Exists('..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.3\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.3\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props'))" />
|
<Error Condition="!Exists('..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.3\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Testing.Extensions.Telemetry.1.5.3\build\netstandard2.0\Microsoft.Testing.Extensions.Telemetry.props'))" />
|
||||||
<Error Condition="!Exists('..\packages\NUnit3TestAdapter.5.0.0\build\net462\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.5.0.0\build\net462\NUnit3TestAdapter.props'))" />
|
<Error Condition="!Exists('..\packages\NUnit3TestAdapter.5.0.0\build\net462\NUnit3TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.5.0.0\build\net462\NUnit3TestAdapter.props'))" />
|
||||||
<Error Condition="!Exists('..\packages\NUnit3TestAdapter.5.0.0\build\net462\NUnit3TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.5.0.0\build\net462\NUnit3TestAdapter.targets'))" />
|
<Error Condition="!Exists('..\packages\NUnit3TestAdapter.5.0.0\build\net462\NUnit3TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit3TestAdapter.5.0.0\build\net462\NUnit3TestAdapter.targets'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<Import Project="..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\build\Microsoft.Testing.Platform.MSBuild.targets" Condition="Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\build\Microsoft.Testing.Platform.MSBuild.targets')" />
|
<Import Project="..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\build\Microsoft.Testing.Platform.MSBuild.targets" Condition="Exists('..\packages\Microsoft.Testing.Platform.MSBuild.1.5.3\build\Microsoft.Testing.Platform.MSBuild.targets')" />
|
||||||
<Import Project="..\packages\NUnit3TestAdapter.5.0.0\build\net462\NUnit3TestAdapter.targets" Condition="Exists('..\packages\NUnit3TestAdapter.5.0.0\build\net462\NUnit3TestAdapter.targets')" />
|
<Import Project="..\packages\NUnit3TestAdapter.5.0.0\build\net462\NUnit3TestAdapter.targets" Condition="Exists('..\packages\NUnit3TestAdapter.5.0.0\build\net462\NUnit3TestAdapter.targets')" />
|
||||||
|
@ -21,10 +21,13 @@
|
|||||||
<package id="NUnit3TestAdapter" version="5.0.0" targetFramework="net471" />
|
<package id="NUnit3TestAdapter" version="5.0.0" targetFramework="net471" />
|
||||||
<package id="System.Buffers" version="4.6.0" targetFramework="net471" />
|
<package id="System.Buffers" version="4.6.0" targetFramework="net471" />
|
||||||
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net471" />
|
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net471" />
|
||||||
|
<package id="System.IO.Pipelines" version="10.0.0-preview.1.25080.5" targetFramework="net471" />
|
||||||
<package id="System.Memory" version="4.6.0" targetFramework="net471" />
|
<package id="System.Memory" version="4.6.0" targetFramework="net471" />
|
||||||
<package id="System.Numerics.Vectors" version="4.6.0" targetFramework="net471" />
|
<package id="System.Numerics.Vectors" version="4.6.0" targetFramework="net471" />
|
||||||
<package id="System.Reflection.Metadata" version="1.6.0" targetFramework="net471" />
|
<package id="System.Reflection.Metadata" version="1.6.0" targetFramework="net471" />
|
||||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net471" />
|
<package id="System.Runtime.CompilerServices.Unsafe" version="6.1.0" targetFramework="net471" />
|
||||||
|
<package id="System.Text.Encodings.Web" version="10.0.0-preview.1.25080.5" targetFramework="net471" />
|
||||||
|
<package id="System.Text.Json" version="10.0.0-preview.1.25080.5" targetFramework="net471" />
|
||||||
<package id="System.Threading.Tasks.Extensions" version="4.6.0" targetFramework="net471" />
|
<package id="System.Threading.Tasks.Extensions" version="4.6.0" targetFramework="net471" />
|
||||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net471" />
|
<package id="System.ValueTuple" version="4.5.0" targetFramework="net471" />
|
||||||
</packages>
|
</packages>
|
Loading…
x
Reference in New Issue
Block a user