本文整理汇总了C#中Results.Next方法的典型用法代码示例。如果您正苦于以下问题:C# Results.Next方法的具体用法?C# Results.Next怎么用?C# Results.Next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Results
的用法示例。
在下文中一共展示了Results.Next方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertToType
public void ConvertToType()
{
const string testFilePath = "C:\testFile.csv";
var readRowResults = new Results<bool>(true)
.Then(true)
.Then(true)
.Then(false);
var columnResults = new Results<List<string>>(new List<string> { "1", "Email", "150.2" })
.Then(new List<string> { "2", "Email", "150.2" })
.Then(new List<string> { "3", "Email", "150.2" });
EventType et1;
_eventTypeConverter.TryParseString("Email", out et1).Returns(x =>
{
x[1] = EventType.Email;
return true;
});
_csvParser.ReadRow(null).ReturnsForAnyArgs(x =>
{
var hasNext = readRowResults.Next();
if (!hasNext) return false;
((Row)x[0]).Columns = columnResults.Next();
return true;
});
_salesLeadCalculationUtils.CalculateWeightedValue(EventType.Email, 0.0).ReturnsForAnyArgs(100);
_csvReaderFactory.CreateCsvParser(testFilePath).ReturnsForAnyArgs(_csvParser);
_salesLeadCalculationUtils.CalculateNormalizedValue(0, 0, 0).ReturnsForAnyArgs(100);
Quartile testQuartile = new Quartile
{
Max = 100,
Min = 75,
Name = "Platinum"
};
_salesLeadCalculationUtils.DetermineQuartile(0).ReturnsForAnyArgs(testQuartile);
List<SalesLead> expectedResult = new List<SalesLead>
{
new SalesLead
{
ContactId = 1,
EventScores = new List<EventScore>
{
new EventScore
{
Score = 150.2,
Type = EventType.Email,
WeightedScore = 100
}
},
EventScoreSum = 100,
EventScoreNormalized = 100,
ContactQuartile = testQuartile
},
new SalesLead
{
ContactId = 2,
EventScores = new List<EventScore>
{
new EventScore
{
Score = 150.2,
Type = EventType.Email,
WeightedScore = 100
}
},
EventScoreSum = 100,
EventScoreNormalized = 100,
ContactQuartile = testQuartile
},
new SalesLead
{
ContactId = 3,
EventScores = new List<EventScore>
{
new EventScore
{
Score = 150.2,
Type = EventType.Email,
WeightedScore = 100
}
},
EventScoreSum = 100,
EventScoreNormalized = 100,
ContactQuartile = testQuartile
}
};
var result = _salesLeadTypeConverter.ConvertToType(testFilePath);
result.Count.ShouldBeEquivalentTo(3);
result.ShouldBeEquivalentTo(expectedResult);
}
示例2: ConvertToTypeShouldReturnNullForInvalidNumberOfColumns
public void ConvertToTypeShouldReturnNullForInvalidNumberOfColumns()
{
const string testFilePath = "C:\testFile.csv";
var readRowResults = new Results<bool>(true)
.Then(false);
var columnResults = new Results<List<string>>(new List<string> { "1", "Email" });
_csvParser.ReadRow(null).ReturnsForAnyArgs(x =>
{
var hasNext = readRowResults.Next();
if (!hasNext) return false;
((Row)x[0]).Columns = columnResults.Next();
return true;
});
_salesLeadCalculationUtils.CalculateWeightedValue(EventType.Email, 0.0).ReturnsForAnyArgs(100);
_csvReaderFactory.CreateCsvParser(testFilePath).ReturnsForAnyArgs(_csvParser);
_salesLeadTypeConverter.ConvertToType(testFilePath).ShouldAllBeEquivalentTo(null);
readRowResults = new Results<bool>(true)
.Then(false);
columnResults = new Results<List<string>>(new List<string> { "1", "Email", "150,1" });
_salesLeadTypeConverter.ConvertToType(testFilePath).ShouldAllBeEquivalentTo(null);
}
示例3: ConvertToTypeShouldReturnNullForMultipleInvalidInputs
public void ConvertToTypeShouldReturnNullForMultipleInvalidInputs()
{
const string testFilePath = "C:\testFile.csv";
var readRowResults = new Results<bool>(true)
.Then(false);
var columnResults = new Results<List<string>>(new List<string> { "NonInteger", "InvalidEventType", "NonDouble" });
EventType et1;
_eventTypeConverter.TryParseString("InvalidEventType", out et1).Returns(x =>
{
x[1] = EventType.Invalid;
return false;
});
_csvParser.ReadRow(null).ReturnsForAnyArgs(x =>
{
var hasNext = readRowResults.Next();
if (!hasNext) return false;
((Row)x[0]).Columns = columnResults.Next();
return true;
});
_salesLeadCalculationUtils.CalculateWeightedValue(EventType.Email, 0.0).ReturnsForAnyArgs(100);
_csvReaderFactory.CreateCsvParser(testFilePath).ReturnsForAnyArgs(_csvParser);
var result = _salesLeadTypeConverter.ConvertToType(testFilePath);
Assert.Null(result);
}
示例4: ConvertToTypeShouldAppendEventScoresToContact1
public void ConvertToTypeShouldAppendEventScoresToContact1()
{
const string testFilePath = "C:\testFile.csv";
var readRowResults = new Results<bool>(true)
.Then(true)
.Then(true)
.Then(false);
var columnResults = new Results<List<string>>(new List<string> { "1", "Email", "150.2" })
.Then(new List<string> { "1", "Email", "150.2" })
.Then(new List<string> { "1", "Email", "150.2" });
EventType et1;
_eventTypeConverter.TryParseString("Email", out et1).Returns(x =>
{
x[1] = EventType.Email;
return true;
});
_csvParser.ReadRow(null).ReturnsForAnyArgs(x =>
{
var hasNext = readRowResults.Next();
if (!hasNext) return false;
((Row)x[0]).Columns = columnResults.Next();
return true;
});
_salesLeadCalculationUtils.CalculateWeightedValue(EventType.Email, 0.0).ReturnsForAnyArgs(100);
_csvReaderFactory.CreateCsvParser(testFilePath).ReturnsForAnyArgs(_csvParser);
var result = _salesLeadTypeConverter.ConvertToType(testFilePath);
result.Count.ShouldBeEquivalentTo(1);
var salesLead = result.FirstOrDefault(x => x.ContactId == 1);
Assert.NotNull(salesLead);
salesLead.EventScores.Count.ShouldBeEquivalentTo(3);
}