|
- using CartWise.Domain.Entities;
-
- namespace CartWise.Domain.Tests;
-
- public class RetailerAndStoreLocationTests
- {
- private static readonly DateTime Now = new(2026, 8, 10, 12, 0, 0, DateTimeKind.Utc);
-
- [Fact]
- public void Retailer_Constructor_SetsNormalizedName()
- {
- var retailer = new Retailer("Trader Joe's");
-
- Assert.Equal("TRADER JOE'S", retailer.NormalizedName);
- }
-
- [Theory]
- [InlineData("")]
- [InlineData(" ")]
- [InlineData(null)]
- public void Retailer_Constructor_ThrowsWhenNameIsMissing(string? name)
- {
- Assert.Throws<ArgumentException>(() => new Retailer(name!));
- }
-
- [Fact]
- public void StoreLocation_Constructor_SetsRequiredFields()
- {
- var retailer = new Retailer("Trader Joe's");
-
- var store = new StoreLocation(retailer.RetailerId, "Downtown", Now, city: "Springfield");
-
- Assert.Equal(retailer.RetailerId, store.RetailerId);
- Assert.Equal("Downtown", store.Name);
- Assert.Equal("Springfield", store.City);
- Assert.Equal(Now, store.CreatedUtc);
- }
-
- [Fact]
- public void StoreLocation_Constructor_ThrowsWhenRetailerIdIsEmpty()
- {
- Assert.Throws<ArgumentException>(() => new StoreLocation(Guid.Empty, "Downtown", Now));
- }
-
- [Theory]
- [InlineData("")]
- [InlineData(" ")]
- [InlineData(null)]
- public void StoreLocation_Constructor_ThrowsWhenNameIsMissing(string? name)
- {
- Assert.Throws<ArgumentException>(() => new StoreLocation(Guid.NewGuid(), name!, Now));
- }
- }
|