I started to use xUnit infrastructure.
(我开始使用xUnit基础结构。)
So I tried to use void Assert.Equal(string expected, string actual)
method. (所以我尝试使用void Assert.Equal(string expected, string actual)
方法。)
[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?
(想知道,是否应该使用string.Clone()方法创建真正的新对象,而不是将同一链接与单个对象进行比较?)
ask by Павел Бобров translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…