private IDatabase CreateDatabase(IConfiguration configuration, IConfiguration dbConfig, string userName, string password, bool createIfNotExists)
        {
            var builder = new SystemBuilder(configuration);
            var system  = builder.BuildSystem();

            var databaseName = dbConfig.GetString("database.name");

            IDatabase database;

            if (!system.DatabaseExists(databaseName))
            {
                if (!createIfNotExists)
                {
                    throw new DeveelDbException(String.Format("The database '{0}' does not exist and it is not set to be created.",
                                                              databaseName));
                }
                database = system.CreateDatabase(dbConfig, userName, password);
            }
            else
            {
                database = system.OpenDatabase(dbConfig);
            }

            return(database);
        }
Exemple #2
0
        public void shouldCreateSystemComponentObject()
        {
            SystemRepository systemRepository = new SystemRepository();
            SystemBuilder    systemBuilder    = new SystemBuilder(systemRepository);
            SystemComponent  sm = systemRepository.Create();

            Assert.NotNull(sm);
            Assert.IsType <SystemComponent>(sm);
        }
        private void OnSetUp(string testName)
        {
            var systemBuilder = new SystemBuilder();
            systemContext = systemBuilder.BuildSystem();

            var dbConfig = CreateDatabaseConfig();

            if (testName != "CreateNewDatabase") {
                database = systemContext.CreateDatabase(dbConfig, TestAdminUser, TestAdminPass);
            }
        }
Exemple #4
0
        public static void CreateSystem()
        {
            Console.WriteLine("Enter the user id to get subordinates:");
            int userID          = Convert.ToInt32(Console.ReadLine());
            SystemRepository sr = new SystemRepository();
            SystemBuilder    sm = new SystemBuilder(sr);

            sm.BuildSystem();
            Console.Write(sm.getSubord(userID));
            Console.ReadLine();
        }
        private const string SystemMapFilePath = "kogge-stone.txt";//

        public SystemTestForKoggeStone()
        {
            _outputProvider      = new SystemCalculator(new LogicalOperationCalculator());
            _inputDataTranslator = new InputDataTranslator();
            var mapFileContentProvider = Substitute.For <IProvideMapFileContent>();

            mapFileContentProvider.GetMapFileContent(SystemMapFilePath).Returns(EmbeddedData.AsString(SystemMapFilePath));

            var systemBuilder = new SystemBuilder(new MapFileParser(), mapFileContentProvider, new BuildSystemModulesMap());

            this._system = systemBuilder.Build(SystemMapFilePath);
        }
        public PrefixAdderSimulator(string systemMapFilePath)
        {
            _outputProvider      = new SystemCalculator(new LogicalOperationCalculator());
            _inputDataTranslator = new InputDataTranslator();

            var systemBuilder = new SystemBuilder(
                new MapFileParser(),
                new ProvideMapFileContent(),
                new BuildSystemModulesMap()
                );

            _system = systemBuilder.Build(systemMapFilePath);
        }
Exemple #7
0
        private void OnSetUp(string testName)
        {
            var systemBuilder = new SystemBuilder();

            systemContext = systemBuilder.BuildSystem();

            var dbConfig = CreateDatabaseConfig();

            if (testName != "CreateNewDatabase")
            {
                database = systemContext.CreateDatabase(dbConfig, TestAdminUser, TestAdminPass);
            }
        }
Exemple #8
0
        public static void Main()
        {
            var nesBuilder = new SystemBuilder()
                             .WithCPU <Ricoh2A03>()
                             .WithLoader <NESLoader>()
                             .WithMemoryMap <NESRawMemoryMap>()
                             .WithComponent <RicohRP2C02>()
                             .WithNESComponents();

            var nes = nesBuilder.Build <NES>();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            using var form = new Form1(nes);
            Application.Run(form);
        }
Exemple #9
0
        public static void CreateSystem()
        {
            Console.WriteLine("Enter the user id to get subordinates:");
            int userID          = Convert.ToInt32(Console.ReadLine());
            SystemRepository sr = new SystemRepository();
            SystemBuilder    sm = new SystemBuilder(sr);

            sm.BuildSystem();
            string result = sm.getSubord(userID);

            if (result != "null")
            {
                Console.WriteLine(result);
            }
            else
            {
                Console.WriteLine("Cant find any subordinates!!!");
            }
            Console.ReadLine();
        }
 public void BuildingSystem_Works()
 {
     var sut = new SystemBuilder();
     var o = sut.InitializeSystem(typeof (IContentLocatorFilter));
     Assert.That(o, !Is.Null);
 }
        public static SystemBuilder WithIdentityService <TIdentityService, TIdentity>(this SystemBuilder systemBuilder)
            where TIdentityService : IIdentityService <TIdentity>
            where TIdentity : IIdentity
        {
            systemBuilder.With(containerBuilder =>
            {
                containerBuilder
                .RegisterType <TIdentityService>()
                .AsSelf()
                .As <IIdentityService <TIdentity> >()
                .InstancePerLifetimeScope();
            });

            return(systemBuilder);
        }
        private IDatabase CreateDatabase(IConfiguration configuration, IConfiguration dbConfig, string userName, string password, bool createIfNotExists)
        {
            var builder = new SystemBuilder(configuration);
            var system = builder.BuildSystem();

            var databaseName = dbConfig.GetString("database.name");

            IDatabase database;

            if (!system.DatabaseExists(databaseName)) {
                if (!createIfNotExists)
                    throw new DeveelDbException(String.Format("The database '{0}' does not exist and it is not set to be created.",
                        databaseName));
                database = system.CreateDatabase(dbConfig, userName, password);
            } else {
                database = system.OpenDatabase(dbConfig);
            }

            return database;
        }