Best NBi code snippet using NBi.Core.Transformation.Transformer.Native.Text.TextToUpper.TextToRemoveChars
TextTest.cs
Source:TextTest.cs  
...414        [TestCase("(null)", "*", "(null)")]415        [TestCase("(empty)", "*", "(empty)")]416        [TestCase("(blank)", "*", "(blank)")]417        [TestCase("(blank)", " ", "(empty)")]418        public void Execute_TextToRemoveChars_Valid(string value, char charToRemove, string expected)419        {420            var function = new TextToRemoveChars(new LiteralScalarResolver<char>(charToRemove));421            var result = function.Evaluate(value);422            Assert.That(result, Is.EqualTo(expected));423        }424        [Test]425        [TestCase("12345678", "BE-***.***.**", "BE-123.456.78")]426        [TestCase("1234567890", "BE-***.***.**", "BE-123.456.78")]427        [TestCase("12345", "BE-***.***.**", "BE-123.45*.**")]428        [TestCase("(null)", "BE-***.***.**", "(null)")]429        [TestCase("(empty)", "BE-***.***.**", "BE-***.***.**")]430        [TestCase("(blank)", "BE-***.***.**", "BE-***.***.**")]431        public void Execute_TextToMask_Valid(string value, string mask, string expected)432        {433            var function = new TextToMask(new LiteralScalarResolver<string>(mask));434            var result = function.Evaluate(value);...TextTransformations.cs
Source:TextTransformations.cs  
...224                return DateTime.SpecifyKind(dateTime, DateTimeKind.Unspecified);225            throw new NBiException($"Impossible to transform the value '{value}' into a date using the format '{Format}'");226        }227    }228    class TextToRemoveChars : AbstractTextTransformation229    {230        public IScalarResolver<char> CharToRemove { get; }231        public TextToRemoveChars(IScalarResolver<char> charToRemove)232            => CharToRemove = charToRemove;233        protected override object EvaluateString(string value)234        {235            var stringBuilder = new StringBuilder();236            foreach (var c in value)237                if (!c.Equals(CharToRemove.Execute()))238                    stringBuilder.Append(c);239            return stringBuilder.ToString();240        }241        protected override object EvaluateBlank()242        {243            if (char.IsWhiteSpace(CharToRemove.Execute()))244                return "(empty)";245            else...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!!
