Best NBi code snippet using NBi.Core.Transformation.Transformer.Native.UtcToLocal.Tokenize
TimeZoneTransformations.cs
Source:TimeZoneTransformations.cs
...18 protected TimeZoneInfo InstantiateTimeZoneInfo(string label)19 {20 var zones = TimeZoneInfo.GetSystemTimeZones();21 var zone = zones.SingleOrDefault(z => z.Id == label)22 ?? zones.SingleOrDefault(z => Tokenize(z.DisplayName).Contains(label.Replace(" ", "")));23 return zone ?? throw new ArgumentOutOfRangeException($"TimeZone '{label}' is not existing on this computer.");24 }25 private string[] Tokenize(string label) =>26 label.Replace("(", ",")27 .Replace(")", ",")28 .Replace(":", ",")29 .Replace(" ", "")30 .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);31 }32 class LocalToUtc : UtcToLocal33 {34 public LocalToUtc(IScalarResolver<string> timeZoneLabel)35 : base(timeZoneLabel)36 { }37 protected override object EvaluateDateTime(DateTime value) =>38 TimeZoneInfo.ConvertTimeToUtc(value, InstantiateTimeZoneInfo(TimeZoneLabel.Execute()));39 }...
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!!