ПИбд-23. Фомичев В.С. Лабораторная работа №1 Усложненная #2

Closed
slavaxom9k wants to merge 2 commits from lab01_Models_Hard into lab01_Models
11 changed files with 504 additions and 16 deletions

View File

@ -0,0 +1,33 @@
using MagicCarpetContracts.Enums;
using MagicCarpetContracts.Exceptions;
using MagicCarpetContracts.Extensions;
using MagicCarpetContracts.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagicCarpetContracts.DataModels;
public class AgencyDataModel(string id, TourType tourType, int count, List<TourAgencyDataModel> tours) : IValidation
{
public string Id { get; private set; } = id;
public TourType Type { get; private set; } = tourType;
public int Count { get; private set; } = count;
public List<TourAgencyDataModel> Tours { get; private set; } = tours;
public void Validate()
{
if (Id.IsEmpty())
throw new ValidationException("Field Id is empty");
if (!Id.IsGuid())
throw new ValidationException("The value in the field Id is not a unique identifier");
if (Type == TourType.None)
throw new ValidationException("Field Type is empty");
if (Count <= 0)
throw new ValidationException("Field Count is less than or equal to 0");
if ((Tours?.Count ?? 0) == 0)
throw new ValidationException("The sale must include tours");
}
}

View File

@ -26,10 +26,10 @@ public class SaleTourDataModel(string saleId, string cocktailId, int count) : IV
throw new ValidationException("The value in the field SaleId is not a unique identifier");
if (TourId.IsEmpty())
throw new ValidationException("Field ProductId is empty");
throw new ValidationException("Field TourId is empty");
if (!TourId.IsGuid())
throw new ValidationException("The value in the field ProductId is not a unique identifier");
throw new ValidationException("The value in the field TourId is not a unique identifier");
if (Count <= 0)
throw new ValidationException("Field Count is less than or equal to 0");

View File

@ -0,0 +1,35 @@
using MagicCarpetContracts.Enums;
using MagicCarpetContracts.Exceptions;
using MagicCarpetContracts.Extensions;
using MagicCarpetContracts.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Runtime.InteropServices.JavaScript.JSType;
namespace MagicCarpetContracts.DataModels;
public class SuppliesDataModel(string id, TourType tourType, DateTime date, int count, List<TourSuppliesDataModel> tours) : IValidation
{
public string Id { get; private set; } = id;
public TourType Type { get; private set; } = tourType;
public DateTime ProductuionDate { get; private set; } = date;
public int Count { get; private set; } = count;
public List<TourSuppliesDataModel> Tours { get; private set; } = tours;
public void Validate()
{
if (Id.IsEmpty())
throw new ValidationException("Field Id is empty");
if (!Id.IsGuid())
throw new ValidationException("The value in the field Id is not a unique identifier");
if (Type == TourType.None)
throw new ValidationException("Field Type is empty");
if (Count <= 0)
throw new ValidationException("Field Count is less than or equal to 0");
if ((Tours?.Count ?? 0) == 0)
throw new ValidationException("The sale must include tours");
}
}

View File

@ -0,0 +1,32 @@
using MagicCarpetContracts.Exceptions;
using MagicCarpetContracts.Extensions;
using MagicCarpetContracts.Infrastructure;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagicCarpetContracts.DataModels;
public class TourAgencyDataModel(string agencyId, string tourId, int count) : IValidation
{
public string AgencyId { get; private set; } = agencyId;
public string TourId { get; private set; } = tourId;
public int Count { get; private set; } = count;
public void Validate()
{
if (AgencyId.IsEmpty())
throw new ValidationException("Field AgencyId is empty");
if (!AgencyId.IsGuid())
throw new ValidationException("The value in the field AgencyId is not a unique identifier");
if (TourId.IsEmpty())
throw new ValidationException("Field TourId is empty");
if (!TourId.IsGuid())
throw new ValidationException("The value in the field TourId is not a unique identifier");
if (Count <= 0)
throw new ValidationException("Field Count is less than or equal to 0");
}
}

View File

@ -12,13 +12,16 @@ using System.Xml.Linq;
namespace MagicCarpetContracts.DataModels;
public class TourDataModel(string id, string tourName, string tourCountry, double price, TourType tourType) : IValidation
public class TourDataModel(string id, string tourName, string tourCountry, double price, TourType tourType,
List<TourSuppliesDataModel> supplies, List<TourAgencyDataModel> agency) : IValidation
{
public string Id { get; private set; } = id;
public string TourName { get; private set; } = tourName;
public string TourCountry { get; private set; } = tourCountry;
public double Price { get; private set; } = price;
public TourType Type { get; private set; } = tourType;
public List<TourSuppliesDataModel> Supplies { get; private set; } = supplies;
public List<TourAgencyDataModel> Agency { get; private set; } = agency;
public void Validate()
{
@ -34,5 +37,9 @@ public class TourDataModel(string id, string tourName, string tourCountry, doubl
throw new ValidationException("Field Price is less than or equal to 0");
if (Type == TourType.None)
throw new ValidationException("Field Type is empty");
if ((Supplies?.Count ?? 0) == 0)
throw new ValidationException("The tour must include supplies");
if ((Agency?.Count ?? 0) == 0)
throw new ValidationException("The tour must include agency");
}
}

View File

@ -0,0 +1,32 @@
using MagicCarpetContracts.Exceptions;
using MagicCarpetContracts.Extensions;
using MagicCarpetContracts.Infrastructure;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagicCarpetContracts.DataModels;
public class TourSuppliesDataModel(string suppliesId, string tourId, int count) : IValidation
{
public string SuppliesId { get; private set; } = suppliesId;
public string TourId { get; private set; } = tourId;
public int Count { get; private set; } = count;
public void Validate()
{
if (SuppliesId.IsEmpty())
throw new ValidationException("Field SuppliesId is empty");
if (!SuppliesId.IsGuid())
throw new ValidationException("The value in the field SuppliesId is not a unique identifier");
if (TourId.IsEmpty())
throw new ValidationException("Field TourId is empty");
if (!TourId.IsGuid())
throw new ValidationException("The value in the field BlandId is not a unique identifier");
if (Count <= 0)
throw new ValidationException("Field Count is less than or equal to 0");
}
}

View File

@ -0,0 +1,79 @@
using MagicCarpetContracts.DataModels;
using MagicCarpetContracts.Enums;
using MagicCarpetContracts.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagicCarpetTests.DataModelTests;
[TestFixture]
internal class AgencyDataModelTests
{
[Test]
public void IdIsNullOrEmptyTest()
{
var model = CreateDataModel(null, TourType.Beach, 1, CreateSubDataModel());
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
model = CreateDataModel(string.Empty, TourType.Beach, 1, CreateSubDataModel());
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void IdIsNotGuidTest()
{
var model = CreateDataModel("id", TourType.Beach, 1, CreateSubDataModel());
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void TypeIsNoneTest()
{
var model = CreateDataModel(Guid.NewGuid().ToString(), TourType.None, 1, CreateSubDataModel());
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void CountIsLessOrZeroTest()
{
var model = CreateDataModel(Guid.NewGuid().ToString(), TourType.None, 0, CreateSubDataModel());
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
model = CreateDataModel(Guid.NewGuid().ToString(), TourType.None, -1, CreateSubDataModel());
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void ToursIsNullOrEmptyTest()
{
var sale = CreateDataModel(Guid.NewGuid().ToString(), TourType.Beach, 1, null);
Assert.That(() => sale.Validate(), Throws.TypeOf<ValidationException>());
sale = CreateDataModel(Guid.NewGuid().ToString(), TourType.Beach, 1, []);
Assert.That(() => sale.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void AllFieldsIsCorrectTest()
{
var id = Guid.NewGuid().ToString();
var type = TourType.Beach;
var count = 1;
var tours = CreateSubDataModel();
var model = CreateDataModel(id, type, count, tours);
Assert.DoesNotThrow(() => model.Validate());
Assert.Multiple(() =>
{
Assert.That(model.Id, Is.EqualTo(id));
Assert.That(model.Type, Is.EqualTo(type));
Assert.That(model.Count, Is.EqualTo(count));
Assert.That(model.Tours, Is.EqualTo(tours));
});
}
private static AgencyDataModel CreateDataModel(string? id, TourType type, int count, List<TourAgencyDataModel> tours)
=> new AgencyDataModel(id, type, count, tours);
private static List<TourAgencyDataModel> CreateSubDataModel()
=> [new(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), 1)];
}

View File

@ -0,0 +1,80 @@
using MagicCarpetContracts.DataModels;
using MagicCarpetContracts.Enums;
using MagicCarpetContracts.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagicCarpetTests.DataModelTests;
[TestFixture]
internal class SuppliesDataModelTests
{
[Test]
public void IdIsNullOrEmptyTest()
{
var model = CreateDataModel(null, TourType.Beach, DateTime.Now, 1, CreateSubDataModel());
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
model = CreateDataModel(string.Empty, TourType.Beach, DateTime.Now, 1, CreateSubDataModel());
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void IdIsNotGuidTest()
{
var model = CreateDataModel("id", TourType.Beach, DateTime.Now, 1, CreateSubDataModel());
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void TypeIsNoneTest()
{
var model = CreateDataModel(Guid.NewGuid().ToString(), TourType.None, DateTime.Now, 1, CreateSubDataModel());
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void CountIsLessOrZeroTest()
{
var model = CreateDataModel(Guid.NewGuid().ToString(), TourType.None, DateTime.Now, 0, CreateSubDataModel());
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
model = CreateDataModel(Guid.NewGuid().ToString(), TourType.None, DateTime.Now, -1, CreateSubDataModel());
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void ToursIsNullOrEmptyTest()
{
var sale = CreateDataModel(Guid.NewGuid().ToString(), TourType.Beach, DateTime.Now, 1, null);
Assert.That(() => sale.Validate(), Throws.TypeOf<ValidationException>());
sale = CreateDataModel(Guid.NewGuid().ToString(), TourType.Beach, DateTime.Now, 1, []);
Assert.That(() => sale.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void AllFieldsIsCorrectTest()
{
var id = Guid.NewGuid().ToString();
var type = TourType.Beach;
var date = DateTime.Now;
var count = 1;
var tours = CreateSubDataModel();
var model = CreateDataModel(id, type, date, count, tours);
Assert.DoesNotThrow(() => model.Validate());
Assert.Multiple(() =>
{
Assert.That(model.Id, Is.EqualTo(id));
Assert.That(model.Type, Is.EqualTo(type));
Assert.That(model.ProductuionDate, Is.EqualTo(date));
Assert.That(model.Count, Is.EqualTo(count));
Assert.That(model.Tours, Is.EqualTo(tours));
});
}
private static SuppliesDataModel CreateDataModel(string? id, TourType type, DateTime date, int count, List<TourSuppliesDataModel> tours)
=> new(id, type, date, count, tours);
private static List<TourSuppliesDataModel> CreateSubDataModel()
=> [new(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), 1)];
}

View File

@ -0,0 +1,75 @@
using MagicCarpetContracts.DataModels;
using MagicCarpetContracts.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagicCarpetTests.DataModelTests;
[TestFixture]
internal class TourAgencyDataModelTests
{
[Test]
public void AgencyIdIsNullOrEmptyTest()
{
var model = CreateDataModel(null, Guid.NewGuid().ToString(), 1);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
model = CreateDataModel(string.Empty, Guid.NewGuid().ToString(), 1);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void AgencyIdIsNotGuidTest()
{
var model = CreateDataModel("id", Guid.NewGuid().ToString(), 1);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void TourIdIsNullOrEmptyTest()
{
var model = CreateDataModel(Guid.NewGuid().ToString(), null, 1);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
model = CreateDataModel(Guid.NewGuid().ToString(), string.Empty, 1);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void TourIdIsNotGuidTest()
{
var model = CreateDataModel(Guid.NewGuid().ToString(), "id", 1);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void CountIsLessOrZeroTest()
{
var model = CreateDataModel(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), 0);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
model = CreateDataModel(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), -1);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void AllFieldsIsCorrectTest()
{
var agencyId = Guid.NewGuid().ToString();
var tourId = Guid.NewGuid().ToString();
var count = 1;
var model = CreateDataModel(agencyId, tourId, count);
Assert.That(() => model.Validate(), Throws.Nothing);
Assert.Multiple(() =>
{
Assert.That(model.AgencyId, Is.EqualTo(agencyId));
Assert.That(model.TourId, Is.EqualTo(tourId));
Assert.That(model.Count, Is.EqualTo(count));
});
}
private static TourAgencyDataModel CreateDataModel(string? agencyId, string? tourId, int count)
=> new(agencyId, tourId, count);
}

View File

@ -3,6 +3,7 @@ using MagicCarpetContracts.Enums;
using MagicCarpetContracts.Exceptions;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -14,50 +15,79 @@ internal class TourDataModelTests
[Test]
public void IdIsNullOrEmptyTest()
{
var cocktail = CreateDataModel(null, "name", "country", 10.5, TourType.Beach);
var cocktail = CreateDataModel(null, "name", "country", 10.5, TourType.Beach,
CreateSuppliesDataModel(), CreateAgencyDataModel());
Assert.That(() => cocktail.Validate(), Throws.TypeOf<ValidationException>());
cocktail = CreateDataModel(string.Empty, "name", "country", 10.5, TourType.Beach);
cocktail = CreateDataModel(string.Empty, "name", "country", 10.5, TourType.Beach,
CreateSuppliesDataModel(), CreateAgencyDataModel());
Assert.That(() => cocktail.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void IdIsNotGuidTest()
{
var cocktail = CreateDataModel("id", "name", "country", 10.5, TourType.Beach);
var cocktail = CreateDataModel("id", "name", "country", 10.5, TourType.Beach,
CreateSuppliesDataModel(), CreateAgencyDataModel());
Assert.That(() => cocktail.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void TourNameIsNullOrEmptyTest()
{
var cocktail = CreateDataModel(Guid.NewGuid().ToString(), null, "country", 10.5, TourType.Beach);
var cocktail = CreateDataModel(Guid.NewGuid().ToString(), null, "country", 10.5, TourType.Beach,
CreateSuppliesDataModel(), CreateAgencyDataModel());
Assert.That(() => cocktail.Validate(), Throws.TypeOf<ValidationException>());
cocktail = CreateDataModel(Guid.NewGuid().ToString(), string.Empty, "country", 10.5, TourType.Beach);
cocktail = CreateDataModel(Guid.NewGuid().ToString(), string.Empty, "country", 10.5, TourType.Beach,
CreateSuppliesDataModel(), CreateAgencyDataModel());
Assert.That(() => cocktail.Validate(), Throws.TypeOf<ValidationException>());
}
public void TourCountryIsNullOrEmptyTest()
{
var cocktail = CreateDataModel(Guid.NewGuid().ToString(), "name", null, 10.5, TourType.Beach);
var cocktail = CreateDataModel(Guid.NewGuid().ToString(), "name", null, 10.5, TourType.Beach,
CreateSuppliesDataModel(), CreateAgencyDataModel());
Assert.That(() => cocktail.Validate(), Throws.TypeOf<ValidationException>());
cocktail = CreateDataModel(Guid.NewGuid().ToString(), "name", string.Empty, 10.5, TourType.Beach);
cocktail = CreateDataModel(Guid.NewGuid().ToString(), "name", string.Empty, 10.5, TourType.Beach,
CreateSuppliesDataModel(), CreateAgencyDataModel());
Assert.That(() => cocktail.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void PriceIsLessOrZeroTest()
{
var cocktail = CreateDataModel(Guid.NewGuid().ToString(), null, null, 0, TourType.Beach);
var cocktail = CreateDataModel(Guid.NewGuid().ToString(), null, null, 0, TourType.Beach,
CreateSuppliesDataModel(), CreateAgencyDataModel());
Assert.That(() => cocktail.Validate(), Throws.TypeOf<ValidationException>());
cocktail = CreateDataModel(Guid.NewGuid().ToString(), string.Empty, string.Empty, -10.5, TourType.Beach);
cocktail = CreateDataModel(Guid.NewGuid().ToString(), string.Empty, string.Empty, -10.5, TourType.Beach,
CreateSuppliesDataModel(), CreateAgencyDataModel());
Assert.That(() => cocktail.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void TourTypeIsNoneTest()
{
var cocktail = CreateDataModel(Guid.NewGuid().ToString(), null, null, 0, TourType.Beach);
var cocktail = CreateDataModel(Guid.NewGuid().ToString(), null, null, 0, TourType.Beach,
CreateSuppliesDataModel(), CreateAgencyDataModel());
Assert.That(() => cocktail.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void SuppliesIsEmptyOrNullTest()
{
var model = CreateDataModel(Guid.NewGuid().ToString(), "name", "country", 10.5, TourType.Beach, [], CreateAgencyDataModel());
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
model = CreateDataModel(Guid.NewGuid().ToString(), "name", "country", 10.5, TourType.Beach, null, CreateAgencyDataModel());
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void AgencyIsEmptyOrNullTest()
{
var model = CreateDataModel(Guid.NewGuid().ToString(), "name", "country", 10.5, TourType.Beach, CreateSuppliesDataModel(), []);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
model = CreateDataModel(Guid.NewGuid().ToString(), "name", "country", 10.5, TourType.Beach, CreateSuppliesDataModel(), null);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void AllFieldsIsCorrectTest()
@ -67,7 +97,9 @@ internal class TourDataModelTests
var tourCountry = "country";
var price = 10.5;
var tourType = TourType.Ski;
var tour = CreateDataModel(tourId, tourName, tourCountry, price, tourType);
var supplies = CreateSuppliesDataModel();
var agency = CreateAgencyDataModel();
var tour = CreateDataModel(tourId, tourName, tourCountry, price, tourType, supplies, agency);
Assert.That(() => tour.Validate(), Throws.Nothing);
Assert.Multiple(() =>
{
@ -76,9 +108,17 @@ internal class TourDataModelTests
Assert.That(tour.TourCountry, Is.EqualTo(tourCountry));
Assert.That(tour.Price, Is.EqualTo(price));
Assert.That(tour.Type, Is.EqualTo(tourType));
Assert.That(tour.Supplies, Is.EqualTo(supplies));
Assert.That(tour.Agency, Is.EqualTo(agency));
});
}
private static TourDataModel CreateDataModel(string? id, string? tourName, string? countryName,double price, TourType tourType) =>
new(id, tourName, countryName,price, tourType);
private static TourDataModel CreateDataModel(string? id, string? tourName, string? countryName, double price, TourType tourType,
List<TourSuppliesDataModel> supplies, List<TourAgencyDataModel> agency) =>
new(id, tourName, countryName,price, tourType, supplies, agency);
private static List<TourSuppliesDataModel> CreateSuppliesDataModel()
=> [new(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), 1)];
private static List<TourAgencyDataModel> CreateAgencyDataModel()
=> [new(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), 1)];
}

View File

@ -0,0 +1,75 @@
using MagicCarpetContracts.DataModels;
using MagicCarpetContracts.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MagicCarpetTests.DataModelTests;
[TestFixture]
internal class TourSuppliesDataModelTests
{
[Test]
public void SuppliesIdIsNullOrEmptyTest()
{
var model = CreateDataModel(null, Guid.NewGuid().ToString(), 1);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
model = CreateDataModel(string.Empty, Guid.NewGuid().ToString(), 1);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void SuppliesIdIsNotGuidTest()
{
var model = CreateDataModel("id", Guid.NewGuid().ToString(), 1);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void TourIdIsNullOrEmptyTest()
{
var model = CreateDataModel(Guid.NewGuid().ToString(), null, 1);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
model = CreateDataModel(Guid.NewGuid().ToString(), string.Empty, 1);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void TourIdIsNotGuidTest()
{
var model = CreateDataModel(Guid.NewGuid().ToString(), "id", 1);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void CountIsLessOrZeroTest()
{
var model = CreateDataModel(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), 0);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
model = CreateDataModel(Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), -1);
Assert.That(() => model.Validate(), Throws.TypeOf<ValidationException>());
}
[Test]
public void AllFieldsIsCorrectTest()
{
var suppliesId = Guid.NewGuid().ToString();
var tourId = Guid.NewGuid().ToString();
var count = 1;
var model = CreateDataModel(suppliesId, tourId, count);
Assert.That(() => model.Validate(), Throws.Nothing);
Assert.Multiple(() =>
{
Assert.That(model.SuppliesId, Is.EqualTo(suppliesId));
Assert.That(model.TourId, Is.EqualTo(tourId));
Assert.That(model.Count, Is.EqualTo(count));
});
}
private static TourSuppliesDataModel CreateDataModel(string? suppliesId, string? tourId, int count)
=> new(suppliesId, tourId, count);
}