Best NBi code snippet using NBi.Core.Sequence.Transformation.Aggregation.Aggregation.Aggregation
AggregationFactoryTest.cs
Source:AggregationFactoryTest.cs
1using NBi.Core.ResultSet;2using NBi.Core.Scalar.Resolver;3using NBi.Core.Sequence.Transformation.Aggregation;4using NBi.Core.Sequence.Transformation.Aggregation.Function;5using NBi.Extensibility.Resolving;6using NUnit.Framework;7using System;8using System.Collections.Generic;9using System.Linq;10using System.Text;11using System.Threading.Tasks;12namespace NBi.Testing.Unit.Core.Sequence.Transformation.Aggregation13{14 public class AggregationFactoryTest15 {16 [Test]17 [TestCase(ColumnType.Numeric, AggregationFunctionType.Sum, typeof(SumNumeric))]18 [TestCase(ColumnType.Numeric, AggregationFunctionType.Average, typeof(AverageNumeric))]19 [TestCase(ColumnType.Numeric, AggregationFunctionType.Min, typeof(MinNumeric))]20 [TestCase(ColumnType.Numeric, AggregationFunctionType.Max, typeof(MaxNumeric))]21 [TestCase(ColumnType.DateTime, AggregationFunctionType.Min, typeof(MinDateTime))]22 [TestCase(ColumnType.DateTime, AggregationFunctionType.Max, typeof(MaxDateTime))]23 public void Instantiate_ColumnTypeandAggregationFunction_CorrectAggregation(ColumnType columnType, AggregationFunctionType function, Type expectedType)24 {25 var factory = new AggregationFactory();26 var aggregation = factory.Instantiate(columnType, function, Array.Empty<IScalarResolver>(), Array.Empty<IAggregationStrategy>());27 Assert.That(aggregation, Is.Not.Null);28 Assert.That(aggregation.Function, Is.TypeOf(expectedType));29 }30 [Test]31 [TestCase(ColumnType.Numeric)]32 [TestCase(ColumnType.Boolean)]33 [TestCase(ColumnType.DateTime)]34 [TestCase(ColumnType.Text)]35 public void Instantiate_ColumnTypeCount_CorrectAggregation(ColumnType columnType)36 {37 var factory = new AggregationFactory();38 var aggregation = factory.Instantiate(columnType, AggregationFunctionType.Count, Array.Empty<IScalarResolver>(), Array.Empty<IAggregationStrategy>());39 Assert.That(aggregation, Is.Not.Null);40 Assert.That(aggregation.Function, Is.InstanceOf<Count>());41 }42 [Test]43 public void Instantiate_ConcantenationText_CorrectAggregation()44 {45 var factory = new AggregationFactory();46 var aggregation = factory.Instantiate(ColumnType.Text, AggregationFunctionType.Concatenation, new List<IScalarResolver> { new LiteralScalarResolver<string>("+")}.ToArray(), Array.Empty<IAggregationStrategy>());47 Assert.That(aggregation, Is.Not.Null);48 Assert.That(aggregation.Function, Is.TypeOf<ConcatenationText>());49 }50 [TestCase(ColumnType.DateTime, AggregationFunctionType.Sum)]51 [TestCase(ColumnType.DateTime, AggregationFunctionType.Average)]52 public void Instantiate_ColumnTypeAndAggregationFunction_CorrectAggregation(ColumnType columnType, AggregationFunctionType function)53 {54 var factory = new AggregationFactory();55 Assert.Throws<ArgumentException>( () => factory.Instantiate(columnType, function, Array.Empty<IScalarResolver>(), Array.Empty<IAggregationStrategy>()));56 }57 }58}...
ConcatenateTest.cs
Source:ConcatenateTest.cs
1using NBi.Core.ResultSet;2using NBi.Core.Scalar.Resolver;3using NBi.Core.Sequence.Transformation.Aggregation.Function;4using NUnit.Framework;5using System;6using System.Collections.Generic;7using System.Linq;8using System.Text;9using System.Threading.Tasks;10namespace NBi.Testing.Unit.Core.Sequence.Transformation.Aggregation.Text11{12 public class ConcatenationTest13 {14 [Test]15 public void Execute_Text_CorrectValue()16 {17 var list = new List<object>() { "alpha", "beta", "gamma"};18 var aggregation = new ConcatenationText(new LiteralScalarResolver<string>("+"));19 Assert.That(aggregation.Execute(list), Is.EqualTo("alpha+beta+gamma"));20 }21 [Test]22 public void Execute_EmptyValue_CorrectValue()23 {24 var list = new List<object>();...
CountTest.cs
Source:CountTest.cs
1using NBi.Core.ResultSet;2using NBi.Core.Scalar.Resolver;3using NBi.Core.Sequence.Transformation.Aggregation.Function;4using NUnit.Framework;5using System;6using System.Collections.Generic;7using System.Linq;8using System.Text;9using System.Threading.Tasks;10namespace NBi.Testing.Unit.Core.Sequence.Transformation.Aggregation.Text11{12 public class CountTest13 {14 [Test]15 public void Execute_Text_CorrectValue()16 {17 var list = new List<object>() { "alpha", "beta", "gamma" };18 var aggregation = new CountText();19 Assert.That(aggregation.Execute(list), Is.EqualTo(3));20 }21 [Test]22 public void Execute_EmptyValue_CorrectValue()23 {24 var list = new List<object>();...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!