diff --git a/CandyHouseSolution/CandyHouseBase/CandyHouseBase.csproj b/CandyHouseSolution/CandyHouseBase/CandyHouseBase.csproj
index a470328..1a8ba7a 100644
--- a/CandyHouseSolution/CandyHouseBase/CandyHouseBase.csproj
+++ b/CandyHouseSolution/CandyHouseBase/CandyHouseBase.csproj
@@ -40,19 +40,16 @@
-
-
-
+
+
-
-
-
-
-
+
+
+
diff --git a/CandyHouseSolution/CandyHouseBase/DataModels/CustomerDataModel.cs b/CandyHouseSolution/CandyHouseBase/DataModels/CustomerDataModel.cs
deleted file mode 100644
index bd167e7..0000000
--- a/CandyHouseSolution/CandyHouseBase/DataModels/CustomerDataModel.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Text.RegularExpressions;
-using CandyHouseBase.Exceptions;
-using CandyHouseBase.Extensions;
-using CandyHouseBase.Infrastructure;
-
-namespace CandyHouseBase.DataModels
-{
- public class CustomerDataModel : IValidation
- {
- public string Id { get; private set; }
- public string FIO { get; private set; }
- public string Phone { get; private set; }
- public string Email { get; private set; }
-
- public CustomerDataModel(string id, string fio, string phone, string email)
- {
- Id = id;
- FIO = fio;
- Phone = phone;
- Email = email;
- }
-
- public void Validate()
- {
- if (Id.IsEmpty()) throw new ValidationException("Field Id is empty");
- if (!Id.IsGuid()) throw new ValidationException("Id must be a GUID");
- if (FIO.IsEmpty()) throw new ValidationException("Field FIO is empty");
- if (Phone.IsEmpty()) throw new ValidationException("Field Phone is empty");
-
- var phoneRegex = new Regex(@"^\+7\d{10}$");
- if (!phoneRegex.IsMatch(Phone)) throw new ValidationException("Invalid phone format");
-
- if (Email.IsEmpty() || !Email.Contains("@")) throw new ValidationException("Invalid email format");
- }
- }
-}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseBase/DataModels/IngredientStockDataModel.cs b/CandyHouseSolution/CandyHouseBase/DataModels/IngredientStockDataModel.cs
deleted file mode 100644
index b869940..0000000
--- a/CandyHouseSolution/CandyHouseBase/DataModels/IngredientStockDataModel.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using CandyHouseBase.Exceptions;
-using CandyHouseBase.Extensions;
-using CandyHouseBase.Infrastructure;
-
-namespace CandyHouseBase.DataModels
-{
- public class IngredientStockDataModel : IValidation
- {
- public string IngredientId { get; private set; }
- public int Quantity { get; private set; }
-
- public IngredientStockDataModel(string ingredientId, int quantity)
- {
- IngredientId = ingredientId;
- Quantity = quantity;
- }
-
- public void Validate()
- {
- if (!IngredientId.IsGuid()) throw new ValidationException("IngredientId must be a GUID");
- if (Quantity < 0) throw new ValidationException("Quantity cannot be negative");
- }
-
- public void AddStock(int amount)
- {
- if (amount <= 0) throw new ValidationException("Added quantity must be positive");
- Quantity += amount;
- }
-
- public void RemoveStock(int amount)
- {
- if (amount <= 0) throw new ValidationException("Removed quantity must be positive");
- if (amount > Quantity) throw new ValidationException("Not enough stock available");
- Quantity -= amount;
- }
- }
-}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseBase/DataModels/OrderDataModel.cs b/CandyHouseSolution/CandyHouseBase/DataModels/OrderDataModel.cs
index 86f2a9f..cb7b168 100644
--- a/CandyHouseSolution/CandyHouseBase/DataModels/OrderDataModel.cs
+++ b/CandyHouseSolution/CandyHouseBase/DataModels/OrderDataModel.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using CandyHouseBase.Enums;
using CandyHouseBase.Exceptions;
using CandyHouseBase.Extensions;
using CandyHouseBase.Infrastructure;
@@ -9,40 +10,37 @@ namespace CandyHouseBase.DataModels
public class OrderDataModel : IValidation
{
public string Id { get; private set; }
- public string CustomerId { get; private set; } // Может быть null, если клиент разовый
+ public string CustomerName { get; private set; } // Может быть null, если клиент разовый
public DateTime OrderDate { get; private set; }
public decimal TotalAmount { get; private set; }
public decimal DiscountAmount { get; private set; }
- public List OrderItems { get; private set; }
- public bool IsCompleted { get; private set; }
+ public string OrderId { get; private set; }
+ public string PekarId { get; private set; }
+ public StatusType StatusType { get; private set; }
- public OrderDataModel(string id, string customerId, DateTime orderDate, decimal totalAmount,
- decimal discountAmount, List orderItems, bool isCompleted)
+ public OrderDataModel(string id, string customerName, DateTime orderDate, decimal totalAmount,
+ decimal discountAmount, string orderId, string pekarId, StatusType statusType)
{
Id = id;
- CustomerId = customerId;
+ CustomerName = customerName;
OrderDate = orderDate;
TotalAmount = totalAmount;
DiscountAmount = discountAmount;
- OrderItems = orderItems;
- IsCompleted = isCompleted;
+ OrderId = orderId;
+ PekarId = pekarId;
+ StatusType = statusType;
}
public void Validate()
{
if (Id.IsEmpty()) throw new ValidationException("Field Id is empty");
if (!Id.IsGuid()) throw new ValidationException("Id must be a GUID");
- if (!CustomerId.IsEmpty() && !CustomerId.IsGuid())
- throw new ValidationException("CustomerId must be a GUID or empty");
- if (OrderItems == null || OrderItems.Count == 0)
- throw new ValidationException("Order must contain at least one product");
+ if (CustomerName.IsEmpty())
+ throw new ValidationException("CustomerName is empty");
if (TotalAmount < 0) throw new ValidationException("TotalAmount cannot be negative");
if (DiscountAmount < 0) throw new ValidationException("DiscountAmount cannot be negative");
- }
-
- public void MarkAsCompleted()
- {
- IsCompleted = true;
+ if (OrderId.IsEmpty()) throw new ValidationException("Field OrderId is empty");
+ if (!OrderId.IsGuid()) throw new ValidationException("OrderId must be a GUID");
}
}
}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseBase/DataModels/OrderItemDataModel.cs b/CandyHouseSolution/CandyHouseBase/DataModels/OrderItemDataModel.cs
deleted file mode 100644
index d55d7be..0000000
--- a/CandyHouseSolution/CandyHouseBase/DataModels/OrderItemDataModel.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using CandyHouseBase.Exceptions;
-using CandyHouseBase.Extensions;
-using CandyHouseBase.Infrastructure;
-
-namespace CandyHouseBase.DataModels
-{
- public class OrderItemDataModel : IValidation
- {
- public string OrderId { get; private set; }
- public string ProductId { get; private set; }
- public int Quantity { get; private set; }
- public decimal Price { get; private set; } // Цена на момент заказа
-
- public OrderItemDataModel(string orderId, string productId, int quantity, decimal price)
- {
- OrderId = orderId;
- ProductId = productId;
- Quantity = quantity;
- Price = price;
- }
-
- public void Validate()
- {
- if (!OrderId.IsGuid()) throw new ValidationException("OrderId must be a GUID");
- if (!ProductId.IsGuid()) throw new ValidationException("ProductId must be a GUID");
- if (Quantity <= 0) throw new ValidationException("Quantity must be positive");
- if (Price < 0) throw new ValidationException("Price cannot be negative");
- }
- }
-}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseBase/DataModels/PekarDataModel.cs b/CandyHouseSolution/CandyHouseBase/DataModels/PekarDataModel.cs
index b0c120a..84a0747 100644
--- a/CandyHouseSolution/CandyHouseBase/DataModels/PekarDataModel.cs
+++ b/CandyHouseSolution/CandyHouseBase/DataModels/PekarDataModel.cs
@@ -25,6 +25,7 @@ namespace CandyHouseBase.DataModels
if (!Id.IsGuid()) throw new ValidationException("Id must be a GUID");
if (FIO.IsEmpty()) throw new ValidationException("Field FIO is empty");
if (Position.IsEmpty()) throw new ValidationException("Field Position is empty");
+ if (!Position.IsGuid()) throw new ValidationException("Field must be a GUID");
if (BonusCoefficient <= 0) throw new ValidationException("BonusCoefficient must be positive");
}
}
diff --git a/CandyHouseSolution/CandyHouseBase/DataModels/PekarHistoryDataModel.cs b/CandyHouseSolution/CandyHouseBase/DataModels/PekarHistoryDataModel.cs
new file mode 100644
index 0000000..d49aa6c
--- /dev/null
+++ b/CandyHouseSolution/CandyHouseBase/DataModels/PekarHistoryDataModel.cs
@@ -0,0 +1,35 @@
+using System;
+using CandyHouseBase.Exceptions;
+using CandyHouseBase.Infrastructure;
+using CandyHouseBase.Extensions;
+
+namespace CandyHouseBase.DataModels
+{
+ public class PekarHistoryDataModel : IValidation
+ {
+ public string PekarId { get; private set; }
+ public string FIO { get; private set; }
+ public string PositionId { get; private set; }
+ public DateTime Date { get; private set; }
+ public decimal BonusCoefficient { get; private set; }
+
+ public PekarHistoryDataModel(string peKarId, string fio, string positionId, decimal bonusCoefficient, DateTime dateTime)
+ {
+ PekarId = peKarId;
+ FIO = fio;
+ PositionId = positionId;
+ BonusCoefficient = bonusCoefficient;
+ Date = dateTime;
+ }
+
+ public void Validate()
+ {
+ if (PekarId.IsEmpty()) throw new ValidationException("Field Id is empty");
+ if (!PekarId.IsGuid()) throw new ValidationException("Id must be a GUID");
+ if (FIO.IsEmpty()) throw new ValidationException("Field FIO is empty");
+ if (PositionId.IsEmpty()) throw new ValidationException("Field Position is empty");
+ if (!PositionId.IsGuid()) throw new ValidationException("Field must be a GUID");
+ if (BonusCoefficient <= 0) throw new ValidationException("BonusCoefficient must be positive");
+ }
+ }
+}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseBase/DataModels/PositionDataModel.cs b/CandyHouseSolution/CandyHouseBase/DataModels/PositionDataModel.cs
new file mode 100644
index 0000000..896f603
--- /dev/null
+++ b/CandyHouseSolution/CandyHouseBase/DataModels/PositionDataModel.cs
@@ -0,0 +1,30 @@
+using System;
+using CandyHouseBase.Enums;
+using CandyHouseBase.Exceptions;
+using CandyHouseBase.Extensions;
+using CandyHouseBase.Infrastructure;
+
+namespace CandyHouseBase.DataModels
+{
+ public class PositionDataModel : IValidation
+ {
+ public string Id { get; set; }
+ public PositionType Type { get; set; }
+ public string Title { get; set; }
+
+ public PositionDataModel(string id, PositionType type, string title)
+ {
+ Id = id;
+ Type = type;
+ Title = title;
+ }
+
+ public void Validate()
+ {
+ if (Id.IsEmpty()) throw new ValidationException("Field Id is empty");
+ if (!Id.IsGuid()) throw new ValidationException("Id must be a GUID");
+ if (string.IsNullOrEmpty(Title)) throw new ValidationException("Field Title is empty");
+ if (!Enum.IsDefined(typeof(PositionType), Type)) throw new ValidationException("Invalid PositionType");
+ }
+ }
+}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseBase/DataModels/ProductDataModel.cs b/CandyHouseSolution/CandyHouseBase/DataModels/ProductDataModel.cs
index f5b801b..2f1d37f 100644
--- a/CandyHouseSolution/CandyHouseBase/DataModels/ProductDataModel.cs
+++ b/CandyHouseSolution/CandyHouseBase/DataModels/ProductDataModel.cs
@@ -7,8 +7,33 @@ namespace CandyHouseBase.DataModels
public class ProductDataModel : IValidation
{
public string Id { get; private set; }
- public string Name { get; private set; }
- public string Description { get; private set; }
+
+ public string Name
+ {
+ get => name;
+ private set
+ {
+ if (!name.IsEmpty()) OldName = name;
+ name = value.Trim();
+ }
+ }
+
+ public string Description
+ {
+ get => description;
+ private set
+ {
+ if (!description.IsEmpty()) OldDescription = description;
+ description = value.Trim();
+ }
+ }
+
+ public string OldName { get; private set; }
+
+ public string OldDescription { get; private set; }
+
+ private string name;
+ private string description;
public ProductDataModel(string id, string name, string description)
{
@@ -22,6 +47,7 @@ namespace CandyHouseBase.DataModels
if (Id.IsEmpty()) throw new ValidationException("Field Id is empty");
if (!Id.IsGuid()) throw new ValidationException("Id must be a GUID");
if (Name.IsEmpty()) throw new ValidationException("Field Name is empty");
+ if (Description.IsEmpty()) throw new ValidationException("Field Description is empty");
}
}
}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseBase/DataModels/ProductStockDataModel.cs b/CandyHouseSolution/CandyHouseBase/DataModels/ProductStockDataModel.cs
deleted file mode 100644
index 2727483..0000000
--- a/CandyHouseSolution/CandyHouseBase/DataModels/ProductStockDataModel.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using CandyHouseBase.Exceptions;
-using CandyHouseBase.Extensions;
-using CandyHouseBase.Infrastructure;
-
-namespace CandyHouseBase.DataModels
-{
- public class ProductStockDataModel : IValidation
- {
- public string ProductId { get; private set; }
- public int Quantity { get; private set; }
-
- public ProductStockDataModel(string productId, int quantity)
- {
- ProductId = productId;
- Quantity = quantity;
- }
-
- public void Validate()
- {
- if (!ProductId.IsGuid()) throw new ValidationException("ProductId must be a GUID");
- if (Quantity < 0) throw new ValidationException("Quantity cannot be negative");
- }
-
- public void AddStock(int amount)
- {
- if (amount <= 0) throw new ValidationException("Added quantity must be positive");
- Quantity += amount;
- }
-
- public void RemoveStock(int amount)
- {
- if (amount <= 0) throw new ValidationException("Removed quantity must be positive");
- if (amount > Quantity) throw new ValidationException("Not enough stock available");
- Quantity -= amount;
- }
- }
-}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseBase/DataModels/ProductionDataModel.cs b/CandyHouseSolution/CandyHouseBase/DataModels/ProductionDataModel.cs
deleted file mode 100644
index 733c68c..0000000
--- a/CandyHouseSolution/CandyHouseBase/DataModels/ProductionDataModel.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-using CandyHouseBase.Exceptions;
-using CandyHouseBase.Extensions;
-using CandyHouseBase.Infrastructure;
-
-namespace CandyHouseBase.DataModels
-{
- public class ProductionDataModel : IValidation
- {
- public string Id { get; private set; }
- public string PekarId { get; private set; }
- public string ProductId { get; private set; }
- public DateTime ProductionDate { get; private set; }
- public int Quantity { get; private set; }
-
- public ProductionDataModel(string id, string pekarId, string productId, DateTime productionDate, int quantity)
- {
- Id = id;
- PekarId = pekarId;
- ProductId = productId;
- ProductionDate = productionDate;
- Quantity = quantity;
- }
-
- public void Validate()
- {
- if (!Id.IsGuid()) throw new ValidationException("Id must be a GUID");
- if (!PekarId.IsGuid()) throw new ValidationException("PekarId must be a GUID");
- if (!ProductId.IsGuid()) throw new ValidationException("ProductId must be a GUID");
- if (Quantity <= 0) throw new ValidationException("Quantity must be positive");
- }
- }
-}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseBase/DataModels/SalaryDataModel.cs b/CandyHouseSolution/CandyHouseBase/DataModels/SalaryDataModel.cs
new file mode 100644
index 0000000..c15b2b6
--- /dev/null
+++ b/CandyHouseSolution/CandyHouseBase/DataModels/SalaryDataModel.cs
@@ -0,0 +1,41 @@
+using System;
+using CandyHouseBase.Exceptions;
+using CandyHouseBase.Extensions;
+using CandyHouseBase.Infrastructure;
+
+namespace CandyHouseBase.DataModels
+{
+ public class SalaryDataModel : IValidation
+ {
+ public string Id { get; private set; }
+ public string PekarId { get; private set; }
+ public DateTime Period { get; private set; }
+ public decimal BaseRate { get; private set; }
+ public decimal BonusRate { get; private set; }
+ public int TotalQuantity { get; private set; }
+ public decimal TotalSalary { get; private set; }
+
+ public SalaryDataModel(string id, string pekarId, DateTime period, decimal baseRate, decimal bonusRate, int totalQuantity, decimal totalSalary)
+ {
+ Id = id;
+ PekarId = pekarId;
+ Period = period;
+ BaseRate = baseRate;
+ BonusRate = bonusRate;
+ TotalQuantity = totalQuantity;
+ TotalSalary = totalSalary;
+ }
+
+ public void Validate()
+ {
+ if (Id.IsEmpty()) throw new ValidationException("Field Id is empty");
+ if (!Id.IsGuid()) throw new ValidationException("Id must be a GUID");
+ if (PekarId.IsEmpty()) throw new ValidationException("Field PekarId is empty");
+ if (!PekarId.IsGuid()) throw new ValidationException("PekarId must be a GUID");
+ if (BaseRate < 0) throw new ValidationException("BaseRate cannot be negative");
+ if (BonusRate < 0) throw new ValidationException("BonusRate cannot be negative");
+ if (TotalQuantity < 0) throw new ValidationException("TotalQuantity cannot be negative");
+ if (TotalSalary < 0) throw new ValidationException("TotalSalary cannot be negative");
+ }
+ }
+}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseBase/DataModels/SupplyDataModel.cs b/CandyHouseSolution/CandyHouseBase/DataModels/SupplyDataModel.cs
deleted file mode 100644
index 32d6e55..0000000
--- a/CandyHouseSolution/CandyHouseBase/DataModels/SupplyDataModel.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-using CandyHouseBase.Exceptions;
-using CandyHouseBase.Extensions;
-using CandyHouseBase.Infrastructure;
-
-namespace CandyHouseBase.DataModels
-{
- public class SupplyDataModel : IValidation
- {
- public string Id { get; private set; }
- public DateTime SupplyDate { get; private set; }
- public List SupplyItems { get; private set; }
-
- public SupplyDataModel(string id, DateTime supplyDate, List supplyItems)
- {
- Id = id;
- SupplyDate = supplyDate;
- SupplyItems = supplyItems;
- }
-
- public void Validate()
- {
- if (!Id.IsGuid()) throw new ValidationException("Id must be a GUID");
- if (SupplyItems == null || SupplyItems.Count == 0) throw new ValidationException("Supply must contain at least one item");
- }
- }
-}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseBase/DataModels/SupplyItemDataModel.cs b/CandyHouseSolution/CandyHouseBase/DataModels/SupplyItemDataModel.cs
deleted file mode 100644
index 947e478..0000000
--- a/CandyHouseSolution/CandyHouseBase/DataModels/SupplyItemDataModel.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using CandyHouseBase.Enums;
-using CandyHouseBase.Exceptions;
-using CandyHouseBase.Extensions;
-using CandyHouseBase.Infrastructure;
-
-namespace CandyHouseBase.DataModels
-{
- public class SupplyItemDataModel : IValidation
- {
- public string SupplyId { get; private set; }
- public string ItemId { get; private set; }
- public int Quantity { get; private set; }
- public ItemType ItemType { get; private set; } // 'ingredient' или 'product'
-
- public SupplyItemDataModel(string supplyId, string itemId, int quantity, ItemType itemType)
- {
- SupplyId = supplyId;
- ItemId = itemId;
- Quantity = quantity;
- ItemType = itemType;
- }
-
- public void Validate()
- {
- if (!SupplyId.IsGuid()) throw new ValidationException("SupplyId must be a GUID");
- if (!ItemId.IsGuid()) throw new ValidationException("ItemId must be a GUID");
- if (Quantity <= 0) throw new ValidationException("Quantity must be positive");
- }
- }
-}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseBase/Enums/ItemType.cs b/CandyHouseSolution/CandyHouseBase/Enums/ItemType.cs
deleted file mode 100644
index 6f7eb5e..0000000
--- a/CandyHouseSolution/CandyHouseBase/Enums/ItemType.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace CandyHouseBase.Enums
-{
- public enum ItemType
- {
- Ingredient = 1,
- Product = 2
- }
-}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseBase/Enums/PositionType.cs b/CandyHouseSolution/CandyHouseBase/Enums/PositionType.cs
new file mode 100644
index 0000000..8313553
--- /dev/null
+++ b/CandyHouseSolution/CandyHouseBase/Enums/PositionType.cs
@@ -0,0 +1,10 @@
+namespace CandyHouseBase.Enums
+{
+ public enum PositionType
+ {
+ None = 1,
+ Small = 2,
+ Medium = 3,
+ Cool = 4,
+ }
+}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseBase/Enums/StatusType.cs b/CandyHouseSolution/CandyHouseBase/Enums/StatusType.cs
new file mode 100644
index 0000000..57a81fa
--- /dev/null
+++ b/CandyHouseSolution/CandyHouseBase/Enums/StatusType.cs
@@ -0,0 +1,10 @@
+namespace CandyHouseBase.Enums
+{
+ public enum StatusType
+ {
+ Pending,
+ Completed,
+ Cancelled,
+ InProgress
+ }
+}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseTests/CandyHouseTests.csproj b/CandyHouseSolution/CandyHouseTests/CandyHouseTests.csproj
index 12447e8..760ff16 100644
--- a/CandyHouseSolution/CandyHouseTests/CandyHouseTests.csproj
+++ b/CandyHouseSolution/CandyHouseTests/CandyHouseTests.csproj
@@ -101,11 +101,14 @@
-
-
+
-
-
+
+
+
+
+
+
diff --git a/CandyHouseSolution/CandyHouseTests/DataModelsTests/CustomerDataModelTests.cs b/CandyHouseSolution/CandyHouseTests/DataModelsTests/CustomerDataModelTests.cs
deleted file mode 100644
index 2ade668..0000000
--- a/CandyHouseSolution/CandyHouseTests/DataModelsTests/CustomerDataModelTests.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using System;
-using CandyHouseBase.DataModels;
-using CandyHouseBase.Exceptions;
-using NUnit.Framework;
-
-namespace CandyHouseTests.DataModelsTests
-{
- [TestFixture]
- public class CustomerDataModelTests
- {
- [Test]
- public void Customer_ShouldThrowException_WhenIdIsInvalid()
- {
- var customerDataModel1 = new CustomerDataModel("", "John Doe", "+79998887766", "john@example.com");
- var customerDataModel2 =
- new CustomerDataModel("invalid-guid", "John Doe", "+79998887766", "john@example.com");
- Assert.Throws(customerDataModel1.Validate);
- Assert.Throws(customerDataModel2.Validate);
- }
-
- [Test]
- public void Customer_ShouldThrowException_WhenFIO_IsEmpty()
- {
- var customerDataModel1 =
- new CustomerDataModel(Guid.NewGuid().ToString(), "", "+79998887766", "john@example.com");
- Assert.Throws(customerDataModel1.Validate);
- }
-
- [Test]
- public void Customer_ShouldThrowException_WhenPhone_IsInvalid()
- {
- var customerDataModel1 =
- new CustomerDataModel(Guid.NewGuid().ToString(), "John Doe", "123456", "john@example.com");
- Assert.Throws(customerDataModel1.Validate);
- }
-
- [Test]
- public void Customer_ShouldThrowException_WhenEmail_IsInvalid()
- {
- var customerDataModel1 =
- new CustomerDataModel(Guid.NewGuid().ToString(), "John Doe", "+79998887766", "invalid-email");
- Assert.Throws(customerDataModel1.Validate);
- }
-
- [Test]
- public void Customer_ShouldCreateSuccessfully_WithValidData()
- {
- var customer = new CustomerDataModel(Guid.NewGuid().ToString(), "John Doe", "+79998887766",
- "john@example.com");
- Assert.That(customer.FIO, Is.EqualTo("John Doe"));
- Assert.That(customer.Phone, Is.EqualTo("+79998887766"));
- Assert.That(customer.Email, Is.EqualTo("john@example.com"));
- }
- }
-}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseTests/DataModelsTests/IngredientDataModelTests.cs b/CandyHouseSolution/CandyHouseTests/DataModelsTests/IngredientDataModelTests.cs
new file mode 100644
index 0000000..ad01684
--- /dev/null
+++ b/CandyHouseSolution/CandyHouseTests/DataModelsTests/IngredientDataModelTests.cs
@@ -0,0 +1,59 @@
+using System;
+using NUnit.Framework;
+using CandyHouseBase.DataModels;
+using CandyHouseBase.Exceptions;
+
+namespace CandyHouseTests.DataModelsTests
+{
+ [TestFixture]
+ public class IngredientDataModelTests
+ {
+ [Test]
+ public void CreateIngredientDataModel_ValidData_ShouldCreateSuccessfully()
+ {
+ var id = Guid.NewGuid().ToString();
+ var name = "Sugar";
+ var unit = "kg";
+ var cost = 10.5m;
+
+ var ingredient = new IngredientDataModel(id, name, unit, cost);
+
+ Assert.AreEqual(id, ingredient.Id);
+ Assert.AreEqual(name, ingredient.Name);
+ Assert.AreEqual(unit, ingredient.Unit);
+ Assert.AreEqual(cost, ingredient.Cost);
+ }
+
+ [Test]
+ public void Validate_ValidData_ShouldNotThrowException()
+ {
+ var ingredient = new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", 10);
+
+ Assert.DoesNotThrow(() => ingredient.Validate());
+ }
+
+ [Test]
+ public void Validate_InvalidId_ShouldThrowValidationException()
+ {
+ var ingredient = new IngredientDataModel("", "Sugar", "kg", 10);
+
+ Assert.Throws(() => ingredient.Validate());
+ }
+
+ [Test]
+ public void Validate_InvalidName_ShouldThrowValidationException()
+ {
+ var ingredient = new IngredientDataModel(Guid.NewGuid().ToString(), "", "kg", 10);
+
+ Assert.Throws(() => ingredient.Validate());
+ }
+
+ [Test]
+ public void Validate_NegativeQuantity_ShouldThrowValidationException()
+ {
+ var ingredient = new IngredientDataModel(Guid.NewGuid().ToString(), "Sugar", "kg", -5);
+
+ Assert.Throws(() => ingredient.Validate());
+ }
+ }
+}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseTests/DataModelsTests/IngredientStockDataModelTests.cs b/CandyHouseSolution/CandyHouseTests/DataModelsTests/IngredientStockDataModelTests.cs
deleted file mode 100644
index 2012b3b..0000000
--- a/CandyHouseSolution/CandyHouseTests/DataModelsTests/IngredientStockDataModelTests.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System;
-using NUnit.Framework;
-using CandyHouseBase.DataModels;
-using CandyHouseBase.Exceptions;
-
-namespace CandyHouseTests.DataModelsTests
-{
- [TestFixture]
- public class IngredientStockDataModelTests
- {
- [Test]
- public void IngredientStock_ShouldThrowException_WhenIdIsInvalid()
- {
- var stock = new IngredientStockDataModel("", 10);
- Assert.Throws(stock.Validate);
- }
-
- [Test]
- public void IngredientStock_ShouldThrowException_WhenQuantityIsNegative()
- {
- var stock = new IngredientStockDataModel(Guid.NewGuid().ToString(), -5);
- Assert.Throws(stock.Validate);
- }
-
- [Test]
- public void IngredientStock_ShouldAddStockCorrectly()
- {
- var stock = new IngredientStockDataModel(Guid.NewGuid().ToString(), 10);
- stock.AddStock(5);
- Assert.That(stock.Quantity, Is.EqualTo(15));
- }
-
- [Test]
- public void IngredientStock_ShouldThrowException_WhenRemovingTooMuchStock()
- {
- var stock = new IngredientStockDataModel(Guid.NewGuid().ToString(), 10);
- Assert.Throws(() => stock.RemoveStock(15));
- }
- }
-}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseTests/DataModelsTests/OrderDataModelTests.cs b/CandyHouseSolution/CandyHouseTests/DataModelsTests/OrderDataModelTests.cs
index d9d36f0..2e4a46a 100644
--- a/CandyHouseSolution/CandyHouseTests/DataModelsTests/OrderDataModelTests.cs
+++ b/CandyHouseSolution/CandyHouseTests/DataModelsTests/OrderDataModelTests.cs
@@ -1,7 +1,7 @@
using System;
-using System.Collections.Generic;
using NUnit.Framework;
using CandyHouseBase.DataModels;
+using CandyHouseBase.Enums;
using CandyHouseBase.Exceptions;
namespace CandyHouseTests.DataModelsTests
@@ -10,32 +10,95 @@ namespace CandyHouseTests.DataModelsTests
public class OrderDataModelTests
{
[Test]
- public void Order_ShouldThrowException_WhenIdIsInvalid()
+ public void CreateOrderDataModel_ValidData_ShouldCreateSuccessfully()
{
- var orderDataModel = new OrderDataModel("", Guid.NewGuid().ToString(), DateTime.UtcNow,
- 100, 5, new List(), false);
- Assert.Throws(orderDataModel.Validate);
+ var id = Guid.NewGuid().ToString();
+ var customerName = "Alice";
+ var orderDate = DateTime.Now;
+ var totalAmount = 100.0m;
+ var discountAmount = 10.0m;
+ var orderId = Guid.NewGuid().ToString();
+ var pekarId = Guid.NewGuid().ToString();
+ var statusType = StatusType.Pending;
+
+ var order = new OrderDataModel(id, customerName, orderDate, totalAmount, discountAmount, orderId, pekarId, statusType);
+
+ Assert.AreEqual(id, order.Id);
+ Assert.AreEqual(customerName, order.CustomerName);
+ Assert.AreEqual(orderDate, order.OrderDate);
+ Assert.AreEqual(totalAmount, order.TotalAmount);
+ Assert.AreEqual(discountAmount, order.DiscountAmount);
+ Assert.AreEqual(orderId, order.OrderId);
+ Assert.AreEqual(pekarId, order.PekarId);
+ Assert.AreEqual(statusType, order.StatusType);
}
[Test]
- public void Order_ShouldThrowException_WhenNoItemsInOrder()
+ public void Validate_ValidData_ShouldNotThrowException()
{
- var orderDataModel = new OrderDataModel(Guid.NewGuid().ToString(),
- Guid.NewGuid().ToString(), DateTime.UtcNow, 100, 5, new List(), false);
- Assert.Throws(orderDataModel.Validate);
+ var order = new OrderDataModel(
+ Guid.NewGuid().ToString(),
+ "Alice",
+ DateTime.Now,
+ 100.0m,
+ 10.0m,
+ Guid.NewGuid().ToString(),
+ Guid.NewGuid().ToString(),
+ StatusType.Pending
+ );
+
+ Assert.DoesNotThrow(() => order.Validate());
}
[Test]
- public void Order_ShouldCreateSuccessfully_WithValidData()
+ public void Validate_InvalidId_ShouldThrowValidationException()
{
- var order = new OrderDataModel(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), DateTime.UtcNow, 200,
- 10, new List
- {
- new OrderItemDataModel(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), 2, 50)
- }, false);
+ var order = new OrderDataModel(
+ "",
+ "Alice",
+ DateTime.Now,
+ 100.0m,
+ 10.0m,
+ Guid.NewGuid().ToString(),
+ Guid.NewGuid().ToString(),
+ StatusType.Pending
+ );
- Assert.That(order.TotalAmount, Is.EqualTo(200));
- Assert.That(order.DiscountAmount, Is.EqualTo(10));
+ Assert.Throws(() => order.Validate());
+ }
+
+ [Test]
+ public void Validate_InvalidCustomerName_ShouldThrowValidationException()
+ {
+ var order = new OrderDataModel(
+ Guid.NewGuid().ToString(),
+ "",
+ DateTime.Now,
+ 100.0m,
+ 10.0m,
+ Guid.NewGuid().ToString(),
+ Guid.NewGuid().ToString(),
+ StatusType.Pending
+ );
+
+ Assert.Throws(() => order.Validate());
+ }
+
+ [Test]
+ public void Validate_NegativeTotalAmount_ShouldThrowValidationException()
+ {
+ var order = new OrderDataModel(
+ Guid.NewGuid().ToString(),
+ "Alice",
+ DateTime.Now,
+ -50.0m,
+ 10.0m,
+ Guid.NewGuid().ToString(),
+ Guid.NewGuid().ToString(),
+ StatusType.Pending
+ );
+
+ Assert.Throws(() => order.Validate());
}
}
}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseTests/DataModelsTests/PekarDataModelTests.cs b/CandyHouseSolution/CandyHouseTests/DataModelsTests/PekarDataModelTests.cs
new file mode 100644
index 0000000..d3bd2d3
--- /dev/null
+++ b/CandyHouseSolution/CandyHouseTests/DataModelsTests/PekarDataModelTests.cs
@@ -0,0 +1,57 @@
+using System;
+using NUnit.Framework;
+using CandyHouseBase.DataModels;
+using CandyHouseBase.Exceptions;
+
+namespace CandyHouseTests.DataModelsTests
+{
+ [TestFixture]
+ public class PekarDataModelTests
+ {
+ [Test]
+ public void CreatePekarDataModel_ValidData_ShouldCreateSuccessfully()
+ {
+ var id = Guid.NewGuid().ToString();
+ var name = "John Doe";
+ var experience = Guid.NewGuid().ToString();
+
+ var pekar = new PekarDataModel(id, name, experience, 0);
+
+ Assert.AreEqual(id, pekar.Id);
+ Assert.AreEqual(name, pekar.FIO);
+ Assert.AreEqual(experience, pekar.Position);
+ }
+
+ [Test]
+ public void Validate_ValidData_ShouldNotThrowException()
+ {
+ var pekar = new PekarDataModel(Guid.NewGuid().ToString(), "John Doe", Guid.NewGuid().ToString(), 6);
+
+ Assert.DoesNotThrow(() => pekar.Validate());
+ }
+
+ [Test]
+ public void Validate_InvalidId_ShouldThrowValidationException()
+ {
+ var pekar = new PekarDataModel("", "John Doe", Guid.NewGuid().ToString(), 0);
+
+ Assert.Throws(() => pekar.Validate());
+ }
+
+ [Test]
+ public void Validate_InvalidName_ShouldThrowValidationException()
+ {
+ var pekar = new PekarDataModel(Guid.NewGuid().ToString(), "", Guid.NewGuid().ToString(), 0);
+
+ Assert.Throws(() => pekar.Validate());
+ }
+
+ [Test]
+ public void Validate_NegativeExperience_ShouldThrowValidationException()
+ {
+ var pekar = new PekarDataModel(Guid.NewGuid().ToString(), "John Doe", "some-invalidate", 0);
+
+ Assert.Throws(() => pekar.Validate());
+ }
+ }
+}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseTests/DataModelsTests/PekarHistoryModelDataTests.cs b/CandyHouseSolution/CandyHouseTests/DataModelsTests/PekarHistoryModelDataTests.cs
new file mode 100644
index 0000000..79c6dfb
--- /dev/null
+++ b/CandyHouseSolution/CandyHouseTests/DataModelsTests/PekarHistoryModelDataTests.cs
@@ -0,0 +1,28 @@
+using System;
+using NUnit.Framework;
+using CandyHouseBase.DataModels;
+
+namespace CandyHouseTests.DataModelsTests
+{
+ [TestFixture]
+ public class PekarHistoryModelDataTests
+ {
+ [Test]
+ public void CreatePekarHistoryDataModel_ValidData_ShouldCreateSuccessfully()
+ {
+ var peKarId = Guid.NewGuid().ToString();
+ var fio = "John Doe";
+ var positionId = Guid.NewGuid().ToString();
+ var bonusCoefficient = 1.5m;
+ var dateTime = DateTime.Now;
+
+ var peKarHistory = new PekarHistoryDataModel(peKarId, fio, positionId, bonusCoefficient, dateTime);
+
+ Assert.AreEqual(peKarId, peKarHistory.PekarId);
+ Assert.AreEqual(fio, peKarHistory.FIO);
+ Assert.AreEqual(positionId, peKarHistory.PositionId);
+ Assert.AreEqual(bonusCoefficient, peKarHistory.BonusCoefficient);
+ Assert.AreEqual(dateTime, peKarHistory.Date);
+ }
+ }
+}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseTests/DataModelsTests/PositionDataModelTests.cs b/CandyHouseSolution/CandyHouseTests/DataModelsTests/PositionDataModelTests.cs
new file mode 100644
index 0000000..1ecc770
--- /dev/null
+++ b/CandyHouseSolution/CandyHouseTests/DataModelsTests/PositionDataModelTests.cs
@@ -0,0 +1,48 @@
+using System;
+using CandyHouseBase.DataModels;
+using CandyHouseBase.Enums;
+using CandyHouseBase.Exceptions;
+using NUnit.Framework;
+
+namespace CandyHouseTests.DataModelsTests
+{
+ [TestFixture]
+ public class PositionDataModelTests
+ {
+ [Test]
+ public void CreatePositionDataModel_ValidData_ShouldCreateSuccessfully()
+ {
+ var id = Guid.NewGuid().ToString();
+ var type = PositionType.Cool;
+ var title = "Manager";
+
+ var position = new PositionDataModel(id, type, title);
+
+ Assert.AreEqual(id, position.Id);
+ Assert.AreEqual(type, position.Type);
+ Assert.AreEqual(title, position.Title);
+ }
+
+ [Test]
+ public void CreatePositionDataModel_InvalidId_ShouldThrowArgumentException()
+ {
+ var invalidId = "";
+ var type = PositionType.Cool;
+ var title = "Manager";
+ var item = new PositionDataModel(invalidId, type, title);
+
+ Assert.Throws(() => item.Validate());
+ }
+
+ [Test]
+ public void CreatePositionDataModel_InvalidTitle_ShouldThrowArgumentException()
+ {
+ var id = Guid.NewGuid().ToString();
+ var type = PositionType.Cool;
+ var invalidTitle = "";
+ var item = new PositionDataModel(id, type, invalidTitle);
+
+ Assert.Throws(() => item.Validate());
+ }
+ }
+}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseTests/DataModelsTests/ProductDataModelTests.cs b/CandyHouseSolution/CandyHouseTests/DataModelsTests/ProductDataModelTests.cs
new file mode 100644
index 0000000..2893e09
--- /dev/null
+++ b/CandyHouseSolution/CandyHouseTests/DataModelsTests/ProductDataModelTests.cs
@@ -0,0 +1,58 @@
+using System;
+using NUnit.Framework;
+using CandyHouseBase.DataModels;
+using CandyHouseBase.Exceptions;
+
+namespace CandyHouseTests.DataModelsTests
+{
+ [TestFixture]
+ public class ProductDataModelTests
+ {
+ [Test]
+ public void CreateProductDataModel_ValidData_ShouldCreateSuccessfully()
+ {
+ var id = Guid.NewGuid().ToString();
+ var name = "Candy";
+ var description = "Delicious candy";
+
+ var product = new ProductDataModel(id, name, description);
+
+ Assert.AreEqual(id, product.Id);
+ Assert.AreEqual(name, product.Name);
+ Assert.AreEqual(description, product.Description);
+ }
+
+ [Test]
+ public void CreateProductDataModel_InvalidId_ShouldThrowArgumentException()
+ {
+ var invalidId = "";
+ var name = "Candy";
+ var description = "Delicious candy";
+ var product = new ProductDataModel(invalidId, name, description);
+
+ Assert.Throws(() => product.Validate());
+ }
+
+ [Test]
+ public void CreateProductDataModel_InvalidName_ShouldThrowArgumentException()
+ {
+ var id = Guid.NewGuid().ToString();
+ var invalidName = "";
+ var description = "Delicious candy";
+ var product = new ProductDataModel(id, invalidName, description);
+
+ Assert.Throws(() => product.Validate());
+ }
+
+ [Test]
+ public void CreateProductDataModel_InvalidDescription_ShouldThrowArgumentException()
+ {
+ var id = Guid.NewGuid().ToString();
+ var name = "Candy";
+ var invalidDescription = "";
+ var product = new ProductDataModel(id, name, invalidDescription);
+
+ Assert.Throws(() => product.Validate());
+ }
+ }
+}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseTests/DataModelsTests/ProductStockDataModelTests.cs b/CandyHouseSolution/CandyHouseTests/DataModelsTests/ProductStockDataModelTests.cs
deleted file mode 100644
index 6de0581..0000000
--- a/CandyHouseSolution/CandyHouseTests/DataModelsTests/ProductStockDataModelTests.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System;
-using NUnit.Framework;
-using CandyHouseBase.DataModels;
-using CandyHouseBase.Exceptions;
-
-namespace CandyHouseTests.DataModelsTests
-{
- [TestFixture]
- public class ProductStockDataModelTests
- {
- [Test]
- public void ProductStock_ShouldThrowException_WhenIdIsInvalid()
- {
- var productStockDataModel = new ProductStockDataModel("", 10);
- Assert.Throws(productStockDataModel.Validate);
- }
-
- [Test]
- public void ProductStock_ShouldThrowException_WhenQuantityIsNegative()
- {
- var productStockDataModel = new ProductStockDataModel(Guid.NewGuid().ToString(), -5);
- Assert.Throws(productStockDataModel.Validate);
- }
-
- [Test]
- public void ProductStock_ShouldAddStockCorrectly()
- {
- var stock = new ProductStockDataModel(Guid.NewGuid().ToString(), 10);
- stock.AddStock(5);
- Assert.That(stock.Quantity, Is.EqualTo(15));
- }
-
- [Test]
- public void ProductStock_ShouldThrowException_WhenRemovingTooMuchStock()
- {
- var stock = new ProductStockDataModel(Guid.NewGuid().ToString(), 10);
- Assert.Throws(() => stock.RemoveStock(15));
- }
- }
-}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseTests/DataModelsTests/RecipeDataModelTests.cs b/CandyHouseSolution/CandyHouseTests/DataModelsTests/RecipeDataModelTests.cs
new file mode 100644
index 0000000..d9314d7
--- /dev/null
+++ b/CandyHouseSolution/CandyHouseTests/DataModelsTests/RecipeDataModelTests.cs
@@ -0,0 +1,58 @@
+using System;
+using NUnit.Framework;
+using CandyHouseBase.DataModels;
+using CandyHouseBase.Exceptions;
+
+namespace CandyHouseTests.DataModelsTests
+{
+ [TestFixture]
+ public class RecipeDataModelTests
+ {
+ [Test]
+ public void CreateRecipeDataModel_ValidData_ShouldCreateSuccessfully()
+ {
+ var productId = Guid.NewGuid().ToString();
+ var ingredientId = Guid.NewGuid().ToString();
+ var quantity = 5;
+
+ var recipe = new RecipeDataModel(productId, ingredientId, quantity);
+
+ Assert.AreEqual(productId, recipe.ProductId);
+ Assert.AreEqual(ingredientId, recipe.IngredientId);
+ Assert.AreEqual(quantity, recipe.Quantity);
+ }
+
+ [Test]
+ public void CreateRecipeDataModel_InvalidProductId_ShouldThrowValidationException()
+ {
+ var invalidProductId = "";
+ var ingredientId = Guid.NewGuid().ToString();
+ var quantity = 5;
+ var recipe = new RecipeDataModel(invalidProductId, ingredientId, quantity);
+
+ Assert.Throws(() => recipe.Validate());
+ }
+
+ [Test]
+ public void CreateRecipeDataModel_InvalidIngredientId_ShouldThrowValidationException()
+ {
+ var productId = Guid.NewGuid().ToString();
+ var invalidIngredientId = "";
+ var quantity = 5;
+ var recipe = new RecipeDataModel(productId, invalidIngredientId, quantity);
+
+ Assert.Throws(() => recipe.Validate());
+ }
+
+ [Test]
+ public void CreateRecipeDataModel_InvalidQuantity_ShouldThrowValidationException()
+ {
+ var productId = Guid.NewGuid().ToString();
+ var ingredientId = Guid.NewGuid().ToString();
+ var invalidQuantity = -1;
+ var recipe = new RecipeDataModel(productId, ingredientId, invalidQuantity);
+
+ Assert.Throws(() => recipe.Validate());
+ }
+ }
+}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseTests/DataModelsTests/SalaryDataModelTests.cs b/CandyHouseSolution/CandyHouseTests/DataModelsTests/SalaryDataModelTests.cs
new file mode 100644
index 0000000..98c37f0
--- /dev/null
+++ b/CandyHouseSolution/CandyHouseTests/DataModelsTests/SalaryDataModelTests.cs
@@ -0,0 +1,61 @@
+using System;
+using CandyHouseBase.DataModels;
+using CandyHouseBase.Exceptions;
+using NUnit.Framework;
+
+namespace CandyHouseTests.DataModelsTests
+{
+ public class SalaryDataModelTests
+ {
+ [Test]
+ public void CreateSalaryDataModel_ValidData_ShouldCreateSuccessfully()
+ {
+ var id = Guid.NewGuid().ToString();
+ var pekarId = Guid.NewGuid().ToString();
+ var period = new DateTime(2023, 10, 1);
+ var baseRate = 1000m;
+ var bonusRate = 200m;
+ var totalQuantity = 50;
+ var totalSalary = 1200m;
+
+ var salaryData = new SalaryDataModel(id, pekarId, period, baseRate, bonusRate, totalQuantity, totalSalary);
+
+ Assert.AreEqual(id, salaryData.Id);
+ Assert.AreEqual(pekarId, salaryData.PekarId);
+ Assert.AreEqual(period, salaryData.Period);
+ Assert.AreEqual(baseRate, salaryData.BaseRate);
+ Assert.AreEqual(bonusRate, salaryData.BonusRate);
+ Assert.AreEqual(totalQuantity, salaryData.TotalQuantity);
+ Assert.AreEqual(totalSalary, salaryData.TotalSalary);
+ }
+
+ [Test]
+ public void CreateSalaryDataModel_InvalidId_ShouldThrowValidationException()
+ {
+ var invalidId = "";
+ var pekarId = Guid.NewGuid().ToString();
+ var period = new DateTime(2023, 10, 1);
+ var baseRate = 1000m;
+ var bonusRate = 200m;
+ var totalQuantity = 50;
+ var totalSalary = 1200m;
+ var salary = new SalaryDataModel(invalidId, pekarId, period, baseRate, bonusRate, totalQuantity,
+ totalSalary);
+ Assert.Throws(() => salary.Validate());}
+
+ [Test]
+ public void CreateSalaryDataModel_InvalidBaseRate_ShouldThrowValidationException()
+ {
+ var id = Guid.NewGuid().ToString();
+ var pekarId = Guid.NewGuid().ToString();
+ var period = new DateTime(2023, 10, 1);
+ var invalidBaseRate = -1000m;
+ var bonusRate = 200m;
+ var totalQuantity = 50;
+ var totalSalary = 1200m;
+ var salary = new SalaryDataModel(id, pekarId, period, invalidBaseRate, bonusRate, totalQuantity,
+ totalSalary);
+ Assert.Throws(() => salary.Validate());
+ }
+ }
+}
\ No newline at end of file
diff --git a/CandyHouseSolution/CandyHouseTests/DataModelsTests/SupplyItemDataModelTests.cs b/CandyHouseSolution/CandyHouseTests/DataModelsTests/SupplyItemDataModelTests.cs
deleted file mode 100644
index 53a843c..0000000
--- a/CandyHouseSolution/CandyHouseTests/DataModelsTests/SupplyItemDataModelTests.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using System;
-using NUnit.Framework;
-using CandyHouseBase.DataModels;
-using CandyHouseBase.Enums;
-using CandyHouseBase.Exceptions;
-
-namespace CandyHouseTests.DataModelsTests
-{
- [TestFixture]
- public class SupplyItemDataModelTests
- {
- [Test]
- public void SupplyItem_ShouldThrowException_WhenSupplyIdIsInvalid()
- {
- var supplyItem = new SupplyItemDataModel("", Guid.NewGuid().ToString(), 10, ItemType.Ingredient);
- Assert.Throws(supplyItem.Validate);
- }
-
- [Test]
- public void SupplyItem_ShouldThrowException_WhenItemIdIsInvalid()
- {
- var supplyItem = new SupplyItemDataModel(Guid.NewGuid().ToString(), "", 10, ItemType.Product);
- Assert.Throws(supplyItem.Validate);
- }
-
- [Test]
- public void SupplyItem_ShouldThrowException_WhenQuantityIsZeroOrNegative()
- {
- var supplyItem = new SupplyItemDataModel(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), 0,
- ItemType.Product);
- Assert.Throws(supplyItem.Validate);
- }
-
- [Test]
- public void SupplyItem_ShouldCreateSuccessfully_WithValidData()
- {
- var supplyItem = new SupplyItemDataModel(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), 10,
- ItemType.Ingredient);
- Assert.That(supplyItem.Quantity, Is.EqualTo(10));
- Assert.That(supplyItem.ItemType, Is.EqualTo(ItemType.Ingredient));
- }
- }
-}
\ No newline at end of file