I started to use xUnit infrastructure. So I tried to use void Assert.Equal(string expected, string actual)
method.
[Fact]
public void CanChangeProductName()
{
// Arrange
var p = new Product()
{
Name = "Name",
Price = 180M
};
var new_name = "NewName";
// Act
p.Name = (string)new_name.Clone(); // ?
// Assert
Assert.Equal(new_name, p.Name);
}
And wondered, should I use string.Clone() method to create truly new object instead of comparison the same link to single object?
Aucun commentaire:
Enregistrer un commentaire