Best NBi code snippet using NBi.Core.Transformation.Transformer.Native.UtcToLocal.LocalToUtc
DateToPointInTimeTest.cs
Source:DateToPointInTimeTest.cs
...185 }186 [Test]187 [TestCase("2018-02-01 03:00:00", "2018-02-01 02:00:00")]188 [TestCase("2018-08-01 02:00:00", "2018-08-01 00:00:00")]189 public void Execute_LocalToUtcWithStandardName_Valid(object value, DateTime expected)190 {191 var function = new LocalToUtc(new LiteralScalarResolver<string>("Romance Standard Time"));192 var result = function.Evaluate(value);193 Assert.That(result, Is.EqualTo(expected));194 }195 [Test]196 [TestCase("2018-02-01 07:00:00", "2018-02-01 06:00:00")]197 [TestCase("2018-08-01 01:00:00", "2018-07-31 23:00:00")]198 public void Execute_LocalToUtcWithCityName_Valid(object value, DateTime expected)199 {200 var function = new LocalToUtc(new LiteralScalarResolver<string>("Brussels"));201 var result = function.Evaluate(value);202 Assert.That(result, Is.EqualTo(expected));203 }204 [Test]205 [TestCase("2018-02-01 07:00:00")]206 public void Execute_DateTimeToDate_Valid(object value)207 {208 var function = new DateTimeToDate();209 var result = function.Evaluate(value);210 Assert.That(result, Is.EqualTo(new DateTime(2018, 2, 1)));211 }212 [Test]213 [TestCase("2018-02-01 07:00:00", "2018-02-01 07:00:00")]214 [TestCase(null, "2001-01-01")]...
TimeZoneTransformations.cs
Source:TimeZoneTransformations.cs
...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 }40}...
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!!