Esempio n. 1
0
        public static void PassingAValueFromAnAppToAConfigurationScript(string result)
        {
            "Given a local config file which sets foo using the value of bar"
            .Given(() =>
            {
                using (var writer = new StreamWriter(new LocalConfigurator().Path))
                {
                    writer.WriteLine(@"Add(""foo"", Configurator.Get<string>(""bar""));");
                    writer.Flush();
                }
            })
            .Teardown(() => File.Delete(new LocalConfigurator().Path));

            "When I set bar to 'baz'"
            .When(() => Configurator.Add("bar", "baz"));

            "And I get foo"
            .And(() => result = Configurator.Get <string>("foo"));

            "Then foo is 'baz'"
            .Then(() => result.Should().Be("baz"));
        }