当前位置: 首页>>代码示例>>C#>>正文


C# Results.Next方法代码示例

本文整理汇总了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);
 }
开发者ID:ckittredge,项目名称:ScoringEngine,代码行数:88,代码来源:SalesLeadTypeConverterTests.cs

示例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);
        }
开发者ID:ckittredge,项目名称:ScoringEngine,代码行数:22,代码来源:SalesLeadTypeConverterTests.cs

示例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);
 }
开发者ID:ckittredge,项目名称:ScoringEngine,代码行数:24,代码来源:SalesLeadTypeConverterTests.cs

示例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);
 }
开发者ID:ckittredge,项目名称:ScoringEngine,代码行数:31,代码来源:SalesLeadTypeConverterTests.cs


注:本文中的Results.Next方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。