Пример #1
0
        public void Execute_OneGlobalVariable_Processed()
        {
            var globalVariables = new Dictionary <string, ITestVariable>()
            {
                { "myVar", new OverridenVariable("myVar", "2018") }
            };
            var formatter = new InvariantFormatter(new ServiceLocator(), globalVariables);
            var result    = formatter.Execute("This year, we are in {@myVar}");

            Assert.That(result, Is.EqualTo("This year, we are in 2018"));
        }
Пример #2
0
        public void Execute_OneGlobalVariablesAdvancedFormatted_Processed()
        {
            var globalVariables = new Dictionary <string, ITestVariable>()
            {
                { "myVar", new OverridenVariable("myVar", new DateTime(2018, 8, 6)) },
            };
            var formatter = new InvariantFormatter(new ServiceLocator(), globalVariables);
            var result    = formatter.Execute("This month is {@myVar:%M}");

            Assert.That(result, Is.EqualTo("This month is 8"));
        }
Пример #3
0
        public void ExecuteWithCulture_OneGlobalVariablesFormatted_ProcessedCultureIndepedant()
        {
            var globalVariables = new Dictionary <string, ITestVariable>()
            {
                { "myVar", new OverridenTestVariable("myVar", new DateTime(2018, 8, 6)) },
            };
            var formatter = new InvariantFormatter(new ServiceLocator(), globalVariables);
            var result    = formatter.Execute("This month is {@myVar:MMMM}");

            Assert.That(result, Is.EqualTo("This month is August"));
        }