2023-12-13 09:33:23 +01:00
|
|
|
using NUnit.Framework;
|
|
|
|
|
using WD7UVN_HFT_2023241.Logic;
|
|
|
|
|
using WD7UVN_HFT_2023241.Repository;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace WD7UVN_HFT_2023241.Test
|
|
|
|
|
{
|
|
|
|
|
public class UpdateTests
|
|
|
|
|
{
|
|
|
|
|
LogicServices logic;
|
|
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
|
public void Setup()
|
|
|
|
|
{
|
|
|
|
|
logic = new LogicServices(new CRUD());
|
2023-12-13 12:12:30 +01:00
|
|
|
Database.Context = new CompanyDbContext();
|
2023-12-13 09:33:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void UpdateCustomerTest()
|
|
|
|
|
{
|
|
|
|
|
var testData = logic.CRUDOperations.ReadAllCustomers().ToList()[0];
|
|
|
|
|
testData.NAME = "Updated Customer Name";
|
|
|
|
|
|
|
|
|
|
logic.CRUDOperations.UpdateCustomer(testData);
|
|
|
|
|
|
|
|
|
|
Assert.That(logic.CRUDOperations.ReadAllCustomers().ToList()[0] == testData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void UpdateEmployeeTest()
|
|
|
|
|
{
|
|
|
|
|
var testData = logic.CRUDOperations.ReadAllEmployees().ToList()[0];
|
|
|
|
|
testData.NAME = "Updated Employee Name";
|
|
|
|
|
|
|
|
|
|
logic.CRUDOperations.UpdateEmployee(testData);
|
|
|
|
|
|
|
|
|
|
Assert.That(logic.CRUDOperations.ReadAllEmployees().ToList()[0] == testData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void UpdateServiceTest()
|
|
|
|
|
{
|
|
|
|
|
var testData = logic.CRUDOperations.ReadAllServices().ToList()[0];
|
|
|
|
|
testData.NAME = "Updated Service Name";
|
|
|
|
|
|
|
|
|
|
logic.CRUDOperations.UpdateService(testData);
|
|
|
|
|
|
|
|
|
|
Assert.That(logic.CRUDOperations.ReadAllServices().ToList()[0] == testData);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void UpdateMaintainerTeamTest()
|
|
|
|
|
{
|
|
|
|
|
var testData = logic.CRUDOperations.ReadAllMaintainerTeams().ToList()[0];
|
|
|
|
|
testData.NAME = "Updated MaintainerTeam Name";
|
|
|
|
|
|
|
|
|
|
logic.CRUDOperations.UpdateMaintainerTeam(testData);
|
|
|
|
|
|
|
|
|
|
Assert.That(logic.CRUDOperations.ReadAllMaintainerTeams().ToList()[0] == testData);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|