Лабораторная работа 2. Изменен порядок выполнения тестов (SetUp на TearDown)

This commit is contained in:
Есения Андрианова 2025-02-18 19:50:15 +04:00
parent 1789fc17d1
commit 3978ab3287
8 changed files with 22 additions and 27 deletions

View File

@ -20,8 +20,8 @@ internal class BuyerBusinessLogicContractTests
_buyerBusinessLogicContract = new BuyerBusinessLogicContract(_buyerStorageContract.Object, new Mock<ILogger>().Object);
}
[SetUp]
public void SetUp()
[TearDown]
public void TearDown()
{
_buyerStorageContract.Reset();
}

View File

@ -26,8 +26,8 @@ namespace NorthBridgeTest.BusinessLogicsContractsTests
_componentBusinessLogicContract = new ComponentBusinessLogicContract(_componentStorageContract.Object, new Mock<ILogger>().Object);
}
[SetUp]
public void SetUp()
[TearDown]
public void TearDown()
{
_componentStorageContract.Reset();
}

View File

@ -20,8 +20,8 @@ internal class ManufacturerBusinessLogicContractTests
_manufacturerBusinessLogicContract = new ManufacturerBusinessLogicContract(_manufacturerStorageContract.Object, new Mock<ILogger>().Object);
}
[SetUp]
public void SetUp()
[TearDown]
public void TearDown()
{
_manufacturerStorageContract.Reset();
}

View File

@ -21,8 +21,8 @@ internal class PostBusinessLogicContractTests
_postBusinessLogicContract = new PostBusinessLogicContract(_postStorageContract.Object, new Mock<ILogger>().Object);
}
[SetUp]
public void SetUp()
[TearDown]
public void TearDown()
{
_postStorageContract.Reset();
}

View File

@ -4,11 +4,6 @@ using NorthBridgeBusinessLogic.Implementations;
using NorthBridgeContract.DataModels;
using NorthBridgeContract.Enums;
using NorthBridgeContract.StoragesContracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NorthBridgeTest.BusinessLogicsContractsTests
{
@ -27,8 +22,8 @@ namespace NorthBridgeTest.BusinessLogicsContractsTests
_productBusinessLogicContract = new ProductBusinessLogicContract(_productStorageContract.Object, _logger.Object);
}
[SetUp]
public void SetUp()
[TearDown]
public void TearDown()
{
_productStorageContract.Reset();
}
@ -38,16 +33,16 @@ namespace NorthBridgeTest.BusinessLogicsContractsTests
{
// Arrange
var components = new List<ComponentDataModel>
{
{
new ComponentDataModel(Guid.NewGuid().ToString(), "Component 1", ComponentType.RAM, Guid.NewGuid().ToString(), 100, false),
new ComponentDataModel(Guid.NewGuid().ToString(), "Component 2", ComponentType.Processor, Guid.NewGuid().ToString(), 200, true)
};
};
var products = new List<ProductDataModel>
{
{
new ProductDataModel(Guid.NewGuid().ToString(), "Product 1", Guid.NewGuid().ToString(), true, components),
new ProductDataModel(Guid.NewGuid().ToString(), "Product 2", Guid.NewGuid().ToString(), false, components)
};
};
_productStorageContract.Setup(x => x.GetList(It.IsAny<bool>())).Returns(products);
@ -69,10 +64,10 @@ namespace NorthBridgeTest.BusinessLogicsContractsTests
{
// Arrange
var components = new List<ComponentDataModel>
{
{
new ComponentDataModel(Guid.NewGuid().ToString(), "Component 1", ComponentType.RAM, Guid.NewGuid().ToString(), 100, false),
new ComponentDataModel(Guid.NewGuid().ToString(), "Component 2", ComponentType.Processor, Guid.NewGuid().ToString(), 200, true)
};
};
var product = new ProductDataModel(Guid.NewGuid().ToString(), "Product 1", Guid.NewGuid().ToString(), true, components);
// Проверка, что метод добавления работает

View File

@ -28,8 +28,8 @@ internal class SalaryBusinessLogicContractTests
_saleStorageContract.Object, _postStorageContract.Object, _workerStorageContract.Object, new Mock<ILogger>().Object);
}
[SetUp]
public void SetUp()
[TearDown]
public void TearDown()
{
_salaryStorageContract.Reset();
_saleStorageContract.Reset();

View File

@ -21,8 +21,8 @@ internal class SaleBusinessLogicContractTests
_saleBusinessLogicContract = new SaleBusinessLogicContract(_saleStorageContract.Object, new Mock<ILogger>().Object);
}
[SetUp]
public void SetUp()
[TearDown]
public void TearDown()
{
_saleStorageContract.Reset();
}

View File

@ -20,8 +20,8 @@ internal class WorkerBusinessLogicContractTests
_workerBusinessLogicContract = new WorkerBusinessLogicContract(_workerStorageContract.Object, new Mock<ILogger>().Object);
}
[SetUp]
public void SetUp()
[TearDown]
public void TearDown()
{
_workerStorageContract.Reset();
}