Sto correndo un test, ma se fallisce non so perché:NUnit. I valori differisce a indice [0]
Proj.Tests.StatTests.GetResults_RegularPage_ReturnListOfResults:
Expected and actual are both <System.Collections.Generic.List`1[Proj.Classes.StatResult]> with 50 elements
Values differ at index [0]
Expected: <test;98318>
But was: <test;98318>
Come potete vedere i valori sono identici. Ecco il codice:
public class StatResult
{
public string word { get; set; }
public UInt64 views { get; set; }
public override string ToString()
{
return String.Format("{0};{1}", word, views);
}
}
[Test]
public void GetResults_RegularPage_ReturnListOfResults()
{
// Arrange
WordStat instance = new WordStat(Constants.WordStatRegularPage);
// Act
List<StatResult> results = instance.GetResults();
// Assert
Assert.AreEqual(results, new List<StatResult>
{
new WordStatResult { word ="test", views = 98318},
new WordStatResult { word ="test board", views = 7801},
//... I shorted it
}
}
ho provato un sacco di modi anche mettendo campione a destra in classe, ma non funziona comunque. Per favore aiuto!
Non dovresti sovraccaricare l'operatore 'equal' di' WordStatResult'? –