コード例 #1
0
        public void EmptyConfigurationShouldEnableAllContexts()
        {
            var configuration = new ConfigurationBuilder()
                                .AddJsonFile("Configuration/empty.json")
                                .Build();

            var options = new KwyjiboOptions();

            options.Configure(configuration);
            var tree = new ContextTree(options);

            tree.Enabled.Should().BeTrue();
        }
コード例 #2
0
        public void SpecifiedConfigurationShouldBeReadCorrectly()
        {
            var configuration = new ConfigurationBuilder()
                                .AddJsonFile("Configuration/sample.json")
                                .Build();

            var options = new KwyjiboOptions();

            options.Configure(configuration);
            options.ForContext <KwyjiboConfigurationExtensionsFixture>()
            .When <IIdentity>(id => id.Name.Contains("kwyjibo"))
            .Throw <SecurityException>();
            var tree = new ContextTree(options);

            tree.Enabled.Should().BeFalse();
            var context = tree.GetContext <KwyjiboConfigurationExtensionsFixture>();

            context.Enabled.Should().BeFalse();
            context.Parent.Enabled.Should().BeFalse();
            context.Parent.Parent.Enabled.Should().BeTrue();
            context.Parent.Parent.Parent.Enabled.Should().BeTrue();
        }