Best NBi code snippet using NBi.Core.Sequence.Resolver.CustomSequenceResolverArgs.CustomSequenceResolverArgs
CustomSequenceResolverTest.cs
Source:CustomSequenceResolverTest.cs
...15 {16 [Test]17 public void Execute_TypeWithoutParam_CorrectEvaluation()18 {19 var args = new CustomSequenceResolverArgs20 (21 new LiteralScalarResolver<string>(GetType().Assembly.Location),22 new LiteralScalarResolver<string>($"{typeof(MyCustomClass).Namespace}.{typeof(MyCustomClass).Name}"),23 new Dictionary<string, IScalarResolver>()24 );25 var resolver = new CustomSequenceResolver<string>(args);26 Assert.That(resolver.Execute(), Has.Member("myFirstValue"));27 Assert.That(resolver.Execute(), Has.Member("mySecondValue"));28 Assert.That(resolver.Execute(), Has.Member("myThirdValue"));29 }30 [Test]31 public void Execute_TypeWithParam_CorrectEvaluation()32 {33 var args = new CustomSequenceResolverArgs34 (35 new LiteralScalarResolver<string>(GetType().Assembly.Location),36 new LiteralScalarResolver<string>($"{typeof(MyCustomClassWithParams).Namespace}.{typeof(MyCustomClassWithParams).Name}"),37 new Dictionary<string, IScalarResolver>() { { "foo", new LiteralScalarResolver<int>(5) }, { "bar", new LiteralScalarResolver<DateTime>(new DateTime(2019, 1, 1)) } }38 );39 var resolver = new CustomSequenceResolver<DateTime>(args);40 var output = resolver.Execute();41 Assert.That(output, Has.Member(new DateTime(2019, 1, 6)));42 Assert.That(output, Has.Member(new DateTime(2018, 12, 27)));43 }44 }45}...
CustomSequenceResolver.cs
Source:CustomSequenceResolver.cs
...13namespace NBi.Core.Sequence.Resolver14{15 class CustomSequenceResolver<T> : AbstractCustomFactory<ISequenceResolver>, ISequenceResolver<T>16 {17 private CustomSequenceResolverArgs Args { get; }18 public CustomSequenceResolver(CustomSequenceResolverArgs args)19 => Args = args;20 protected override string CustomKind => "custom evaluation of a sequence";21 public List<T> Execute()22 {23 var instance = Instantiate(Args);24 var value = instance.Execute();25 return value.Cast<T>().ToList();26 }27 IList ISequenceResolver.Execute() => Execute();28 object IResolver.Execute() => Execute();29 }30}...
CustomSequenceResolverArgs.cs
Source:CustomSequenceResolverArgs.cs
...7using System.Text;8using System.Threading.Tasks;9namespace NBi.Core.Sequence.Resolver10{11 public class CustomSequenceResolverArgs : ISequenceResolverArgs, ICustomArgs12 {13 public IScalarResolver<string> AssemblyPath { get; }14 public IScalarResolver<string> TypeName { get; }15 public IReadOnlyDictionary<string, IScalarResolver> Parameters { get; }16 public CustomSequenceResolverArgs(IScalarResolver<string> assemblyPath, IScalarResolver<string> typeName, IDictionary<string, IScalarResolver> parameters)17 => (AssemblyPath, TypeName, Parameters) = (assemblyPath, typeName, new ReadOnlyDictionary<string, IScalarResolver>(parameters));18 }19}...
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!!