Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

54 řádky
1.5KB

  1. using CartWise.Domain.Entities;
  2. namespace CartWise.Domain.Tests;
  3. public class RetailerAndStoreLocationTests
  4. {
  5. private static readonly DateTime Now = new(2026, 8, 10, 12, 0, 0, DateTimeKind.Utc);
  6. [Fact]
  7. public void Retailer_Constructor_SetsNormalizedName()
  8. {
  9. var retailer = new Retailer("Trader Joe's");
  10. Assert.Equal("TRADER JOE'S", retailer.NormalizedName);
  11. }
  12. [Theory]
  13. [InlineData("")]
  14. [InlineData(" ")]
  15. [InlineData(null)]
  16. public void Retailer_Constructor_ThrowsWhenNameIsMissing(string? name)
  17. {
  18. Assert.Throws<ArgumentException>(() => new Retailer(name!));
  19. }
  20. [Fact]
  21. public void StoreLocation_Constructor_SetsRequiredFields()
  22. {
  23. var retailer = new Retailer("Trader Joe's");
  24. var store = new StoreLocation(retailer.RetailerId, "Downtown", Now, city: "Springfield");
  25. Assert.Equal(retailer.RetailerId, store.RetailerId);
  26. Assert.Equal("Downtown", store.Name);
  27. Assert.Equal("Springfield", store.City);
  28. Assert.Equal(Now, store.CreatedUtc);
  29. }
  30. [Fact]
  31. public void StoreLocation_Constructor_ThrowsWhenRetailerIdIsEmpty()
  32. {
  33. Assert.Throws<ArgumentException>(() => new StoreLocation(Guid.Empty, "Downtown", Now));
  34. }
  35. [Theory]
  36. [InlineData("")]
  37. [InlineData(" ")]
  38. [InlineData(null)]
  39. public void StoreLocation_Constructor_ThrowsWhenNameIsMissing(string? name)
  40. {
  41. Assert.Throws<ArgumentException>(() => new StoreLocation(Guid.NewGuid(), name!, Now));
  42. }
  43. }

Powered by TurnKey Linux.