示例#1
0
        public static FightBuilder ConfigureStorage(this FightBuilder fightBuilder, Action <StorageBuilder> setupAction)
        {
            StorageBuilder builder = new StorageBuilder(fightBuilder.Services);

            setupAction?.Invoke(builder);
            builder.Build();
            return(fightBuilder);
        }
示例#2
0
        private static void InjectStrongConfiguration(WebHostBuilderContext host, IServiceCollection services)
        {
            var builder = new ConfigurationBuilder()
                          .AddJsonFile("appsettings.json")
                          .AddJsonFile($"appsettings.{host.HostingEnvironment.EnvironmentName}.json", optional: true)
                          .Build();

            var config = builder.Get <CrispinConfiguration>() ?? new CrispinConfiguration();

            services.AddSingleton(StorageBuilder.Build(config));
            services.AddSingleton(config);
        }
        public void returns_excepted_services_count()
        {
            StorageBuilder builder = new StorageBuilder().Register <TestClass2>().Register <TestClass>();

            Assert.IsTrue(builder.Build().Services.GetServices().Count() == 2);
        }
        public void returns_object_is_equals_to_builder_Object()
        {
            StorageBuilder builder = new StorageBuilder();

            Assert.AreEqual(builder.Object, builder.Build());
        }
        public void returns_not_null()
        {
            StorageBuilder builder = new StorageBuilder();

            Assert.NotNull(builder.Build());
        }
        public void returns_object_is_IStorage()
        {
            StorageBuilder builder = new StorageBuilder();

            Assert.IsTrue(builder.Build() is IStorage);
        }
        public void returns_instance_of_Storage()
        {
            StorageBuilder builder = new StorageBuilder();

            Assert.IsInstanceOf <Storage>(builder.Build());
        }
 object exec(StorageBuilder builder)
 {
     return(builder.Build());
 }