-
-
Save dcomartin/167c01dc4945364b101373bc9955a253 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Xunit; | |
namespace ValueObject | |
{ | |
public record Currency(string Symbol) | |
{ | |
public static Currency CAD => new("CAD"); | |
public static Currency USD => new("USD"); | |
} | |
public record Money | |
{ | |
public Currency Currency { get; } | |
public decimal Amount { get; } | |
public Money(Currency currency, decimal amount) | |
{ | |
Currency = currency; | |
Amount = amount; | |
} | |
} | |
public class MoneyTests | |
{ | |
[Fact] | |
public void Test() | |
{ | |
var money1 = new Money(Currency.CAD, 100); | |
var money2 = new Money(Currency.CAD, 100); | |
Assert.Equal(money1, money2); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment