public void Instantiate_SentinelLoopDateTime_LoopSequenceResolver() { var args = new SentinelLoopSequenceResolverArgs <DateTime, IDuration>(new DateTime(2018, 1, 1), new DateTime(2018, 3, 1), new FixedDuration(new TimeSpan(1, 0, 0, 0)), IntervalMode.Close); var factory = new SequenceResolverFactory(null); var resolver = factory.Instantiate <DateTime>(args); Assert.That(resolver, Is.TypeOf <LoopSequenceResolver <DateTime> >()); }
public void Instantiate_SentinelLoopDecimal_LoopSequenceResolver() { var args = new SentinelLoopSequenceResolverArgs <decimal, decimal>(5, 10, 2, IntervalMode.Close); var factory = new SequenceResolverFactory(null); var resolver = factory.Instantiate <decimal>(args); Assert.That(resolver, Is.TypeOf <LoopSequenceResolver <decimal> >()); }
public void Instantiate_CountLoopDecimal_LoopSequenceResolver() { var args = new CountLoopSequenceResolverArgs <decimal, decimal>(5, 10, 2); var factory = new SequenceResolverFactory(null); var resolver = factory.Instantiate <decimal>(args); Assert.That(resolver, Is.TypeOf <LoopSequenceResolver <decimal> >()); }
public void Instantiate_List_ListSequenceResolver() { var resolvers = new List <IScalarResolver>() { new LiteralScalarResolver <string>("2015-01-01"), new LiteralScalarResolver <string>("2016-01-01"), }; var args = new ListSequenceResolverArgs(resolvers); var factory = new SequenceResolverFactory(null); var resolver = factory.Instantiate <DateTime>(args); Assert.That(resolver, Is.TypeOf <ListSequenceResolver <DateTime> >()); }
public void Build() { if (!isSetup) { throw new InvalidOperationException(); } if (obj == InstanceSettlingXml.Unique) { args = new DefaultInstanceArgs(); } else if ((obj as InstanceSettlingXml).Variable != null) { var variable = (obj as InstanceSettlingXml).Variable; var argsBuilder = new SequenceResolverArgsBuilder(serviceLocator); argsBuilder.Setup(settings); argsBuilder.Setup(globalVariables); argsBuilder.Setup(variable.Type); if (variable.SentinelLoop != null) { argsBuilder.Setup(variable.SentinelLoop); } else if (variable.Items != null) { argsBuilder.Setup(variable.Items); } else { throw new ArgumentOutOfRangeException(); } argsBuilder.Build(); var factory = new SequenceResolverFactory(serviceLocator); args = new SingleVariableInstanceArgs() { Name = variable.Name, Resolver = factory.Instantiate(variable.Type, argsBuilder.GetArgs()), Categories = (obj as InstanceSettlingXml).Categories, Traits = (obj as InstanceSettlingXml).Traits.ToDictionary(x => x.Name, x => x.Value), }; } }