Example #1
0
        public Task InitWebSocketConnectionAsync(bool useRdp)
        {
            return(Task.Run(() =>
            {
                Log.Level = NLog.LogLevel.Trace;

                if (!useRdp)
                {
                    _session = CoreFactory.CreateSession(new DeployedPlatformSession.Params()
                                                         .Host(WebSocketHost)
                                                         .WithDacsUserName(TrepUsername)
                                                         .WithDacsApplicationID(TrepAppid)
                                                         .WithDacsPosition(TrepPosition)
                                                         .OnState(processOnState)
                                                         .OnEvent(processOnEvent));
                }
                else
                {
                    System.Console.WriteLine("Start RDP PlatformSession");
                    _session = CoreFactory.CreateSession(new PlatformSession.Params()
                                                         .WithOAuthGrantType(new GrantPassword().UserName(RdpUser)
                                                                             .Password(RdpPassword))
                                                         .AppKey(RdpAppKey)
                                                         .WithTakeSignonControl(true)
                                                         .OnState(processOnState)
                                                         .OnEvent(processOnEvent));
                }
                _session.OpenAsync().ConfigureAwait(false);
            }));
        }
Example #2
0
 static void EnsureFactory()
 {
     if (factory == null)
     {
         factory = new CoreFactory();
     }
 }
Example #3
0
        // ** CHANGES BELOW ARE NOT REQUIRED

        // GetSession
        // Based on the above Session Type, retrieve the Session used to define how you want to access the platform.
        //
        public static ISession GetSession()
        {
            switch (SessionType)
            {
            case SessionTypeEnum.RDP:
                // Createn and return an RDP Session
                return(CoreFactory.CreateSession(new PlatformSession.Params()
                                                 .OAuthGrantType(new GrantPassword().UserName(Credentials.EDPUser)
                                                                 .Password(Credentials.EDPPassword))
                                                 .AppKey(Credentials.AppKey)
                                                 .WithTakeSignonControl(true)
                                                 .OnState((s, state, msg) => Console.WriteLine($"{DateTime.Now}:{msg}. (State: {state})"))
                                                 .OnEvent((s, eventCode, msg) => Console.WriteLine($"{DateTime.Now}:{msg}. (Event: {eventCode})"))));

            case SessionTypeEnum.TREP:
                return(CoreFactory.CreateSession(new DeployedPlatformSession.Params().Host(Credentials.TREPHost)
                                                 .OnState((s, state, msg) => Console.WriteLine($"{DateTime.Now}:{msg}. (State: {state})"))
                                                 .OnEvent((s, eventCode, msg) => Console.WriteLine($"{DateTime.Now}:{msg}. (Event: {eventCode})"))));

            case SessionTypeEnum.EIKON:
                return(CoreFactory.CreateSession(new DesktopSession.Params().AppKey(Credentials.AppKey)
                                                 .OnState((s, state, msg) => Console.WriteLine($"{DateTime.Now}:{msg}. (State: {state})"))
                                                 .OnEvent((s, eventCode, msg) => Console.WriteLine($"{DateTime.Now}:{msg}. (Event: {eventCode})"))));

            default:
                throw new IndexOutOfRangeException($"Unknown Session Type: {SessionType}");
            }
        }
Example #4
0
 /// <summary>
 /// Threaded function to generate the designs.
 ///
 /// Creates the laminations, then cores, then windings, then finally the designs.
 /// </summary>
 private void GenerateDesigns()
 {
     try
     {
         CurrentProcess = "Generating Laminations";
         //Laminations = new LaminationFactory(laminationSkips, (RangeInteger)parameters["StdLamination"], (RangeInteger)parameters["LamShape"], Specification.Phase, (RangeInteger)parameters["LamGrade"], (RangeInteger)parameters["LamThickness"],
         //    (RangeDouble)parameters["Tongue"], (RangeDouble)parameters["Yoke"], (RangeDouble)parameters["Width"], (RangeDouble)parameters["Height"], IncrementCurrentProcessProgress);
         Laminations = new LaminationFactory(ToIterateLaminations, Specification.Phase, (RangeDouble)parameters["Tongue"], (RangeDouble)parameters["Yoke"], (RangeDouble)parameters["Width"], (RangeDouble)parameters["Height"], IncrementCurrentProcessProgress);
         if (Laminations.Laminations.Count == 0)
         {
             throw new NoCoresFound("No laminations could be generated with the given parameters.");
         }
         CurrentProcess = "Generating Cores";
         Cores          = new CoreFactory(Laminations.Laminations, (RangeDouble)parameters["Stack"], (RangeDouble)parameters["FluxDensity"], Specification.StackingFactor,
                                          Specification.DestructionFactor, Specification.ExcitationFactor, Specification.TubeWindowMargin, IncrementCurrentProcessProgress);
         CurrentProcess = "Gathering Tubes";
         //Now uses static data
         CurrentProcess = "Gathering Wires";
         //Now uses static data
         CurrentProcess = "Generating Windings";
         Windings       = new WindingFactory(Specification.BaseWindings, usePermutations, IncrementCurrentProcessProgress);
         CurrentProcess = "Gathering Core Losses";
         //Now uses static data
         CurrentProcess     = "Creating Designs";
         Designs            = new DesignFactory(Specification, Cores.Cores, Windings.Windings, (RangeInteger)parameters["UI_Styles"], creationQueue, IncrementCurrentProcessProgress);
         FinishedGeneration = true;
     }
     catch (TransformerOptimizerException ex)
     {
         HasException     = true;
         ExceptionMessage = ex.Message;
         AbortThreads();
     }
 }
Example #5
0
        private static IDatabase _OpenDatabase(string databaseId)
        {
            try
            {
                var                 info  = ORMConfig.ORMConfiguration.GetDatabaseInfo(databaseId);
                IDbConnection       cnn   = CoreFactory.CreateDbProvider(databaseId).CreateConnection(info.ConnectString);
                ISQLExecutor        exe   = new SQLExecutor(databaseId, cnn);
                IObjectMapInfoCache cache = CoreFactory.ObjectMapInfoCache;

                var           dialect = CoreFactory.CreateDialectProvider(databaseId);
                IModelSQLEmit emit    = dialect.CreateModelSQLEmit(cache);
                IMetaQuery    meta    = dialect.CreateMetaQuery(exe);

                if (cnn.State != ConnectionState.Open)
                {
                    cnn.Open();
                }

                return(new Database(exe, emit, meta));
            }
            catch (Exception ex)
            {
                throw ex.CreateWrapException <SessionException>();
            }
        }
Example #6
0
 public void SetUp()
 {
     if (!AppConfig.Loaded)
     {
         AppConfig.Load(ConfigFactory.CreateXmlConfig());
     }
     _emit = CoreFactory.CreateDialectProvider("dest").CreateMappingSQLEmit(CoreFactory.ObjectMapInfoCache);
 }
        static void Main(string[] args)
        {
            // Set Logger level to Trace
            Log.Level = NLog.LogLevel.Trace;

            bool     useRDP = false;
            ISession session;

            if (!useRDP)
            {
                System.Console.WriteLine("Start DeploytedPlatformSession");
                session = CoreFactory.CreateSession(new DeployedPlatformSession.Params()
                                                    .Host(WebSocketHost)
                                                    .WithDacsUserName(TREPUser)
                                                    .WithDacsApplicationID(appID)
                                                    .WithDacsPosition(position)
                                                    .OnState((s, state, msg) =>
                {
                    Console.WriteLine($"{DateTime.Now}:  {msg}. (State: {state})");
                    _sessionState = state;
                })
                                                    .OnEvent((s, eventCode, msg) => Console.WriteLine($"{DateTime.Now}: {msg}. (Event: {eventCode})")));
            }
            else
            {
                System.Console.WriteLine("Start RDP PlatformSession");
                session = CoreFactory.CreateSession(new PlatformSession.Params()
                                                    .OAuthGrantType(new GrantPassword().UserName(RDPUser)
                                                                    .Password(RDPPassword))
                                                    .AppKey(RDPAppKey)
                                                    .WithTakeSignonControl(true)
                                                    .OnState((s, state, msg) =>
                {
                    Console.WriteLine($"{DateTime.Now}:  {msg}. (State: {state})");
                    _sessionState = state;
                })
                                                    .OnEvent((s, eventCode, msg) => Console.WriteLine($"{DateTime.Now}: {msg}. (Event: {eventCode})")));
            }
            session.Open();
            if (_sessionState == Session.State.Opened)
            {
                System.Console.WriteLine("Session is now Opened");
                System.Console.WriteLine("Sending MRN_STORY request");
                using (IStream stream = DeliveryFactory.CreateStream(
                           new ItemStream.Params().Session(session)
                           .Name("MRN_STORY")
                           .WithDomain("NewsTextAnalytics")
                           .OnRefresh((s, msg) => Console.WriteLine($"{msg}\n\n"))
                           .OnUpdate((s, msg) => ProcessMRNUpdateMessage(msg))
                           .OnError((s, msg) => Console.WriteLine(msg))
                           .OnStatus((s, msg) => Console.WriteLine($"{msg}\n\n"))))
                {
                    stream.Open();
                    Thread.Sleep(runtime);
                }
            }
        }
Example #8
0
        public static void Main()
        {
            ICoreFactory       coreFactory          = new CoreFactory();
            IFragmentFactory   fragment             = new FragmentFactory();
            IRepository        powerPlantRepository = new PowerPlantRepository();
            CommandInterpreter commandInterpreter   = new CommandInterpreter(coreFactory, fragment, powerPlantRepository);
            Engine             engine = new Engine(commandInterpreter);

            engine.Run();
        }
 public ContactsStatesDataSource(EcmFactory ecmFactory, CoreFactory coreFactory, ReportDataProviderExt reportDataProvider, RecipientRepository recipientRepository)
 {
     Assert.ArgumentNotNull(ecmFactory, "ecmFactory");
     Assert.ArgumentNotNull(coreFactory, "coreFactory");
     Assert.ArgumentNotNull(reportDataProvider, "reportDataProvider");
     Assert.ArgumentNotNull(recipientRepository, "recipientRepository");
     this.ecmFactory          = ecmFactory;
     this.coreFactory         = coreFactory;
     this.reportDataProvider  = reportDataProvider;
     this.recipientRepository = recipientRepository;
 }
        static void Main()
        {
            // Set Logger level to Trace
            Log.Level = NLog.LogLevel.Trace;

            bool     useRDP = true;
            ISession session;

            if (!useRDP)
            {
                System.Console.WriteLine("Start DeploytedPlatformSession");
                session = CoreFactory.CreateSession(new DeployedPlatformSession.Params()
                                                    .Host(WebSocketHost)
                                                    .WithDacsUserName(RTDSUser)
                                                    .WithDacsApplicationID(appID)
                                                    .WithDacsPosition(position)
                                                    .OnState((s, state, msg) =>
                {
                    Console.WriteLine($"{DateTime.Now}:  {msg}. (State: {state})");
                    _sessionState = state;
                })
                                                    .OnEvent((s, eventCode, msg) => Console.WriteLine($"{DateTime.Now}: {msg}. (Event: {eventCode})")));
            }
            else
            {
                System.Console.WriteLine("Start RDP PlatformSession");
                session = CoreFactory.CreateSession(new PlatformSession.Params()
                                                    .WithOAuthGrantType(new GrantPassword().UserName(RDPUser)
                                                                        .Password(RDPPassword))
                                                    .AppKey(RDPAppKey)
                                                    .WithTakeSignonControl(true)
                                                    .OnState((s, state, msg) =>
                {
                    Console.WriteLine($"{DateTime.Now}:  {msg}. (State: {state})");
                    _sessionState = state;
                })
                                                    .OnEvent((s, eventCode, msg) => Console.WriteLine($"{DateTime.Now}: {msg}. (Event: {eventCode})")));
            }
            session.Open();
            if (_sessionState == Session.State.Opened)
            {
                System.Console.WriteLine("Session is now Opened");
                System.Console.WriteLine("Sending MRN_STORY request");
                using var mrnNews = MachineReadableNews.Definition().OnError((stream, err) => Console.WriteLine($"{DateTime.Now}:{err}"))
                                    .OnStatus((stream, status) => Console.WriteLine(status))
                                    .NewsDatafeed(MachineReadableNews.Datafeed.MRN_STORY)
                                    .OnNewsStory((stream, newsItem) => ProcessNewsContent(newsItem.Raw));
                {
                    mrnNews.Open();
                    Thread.Sleep(runtime);
                }
            }
        }
 public void UpdateEmployeeReferenece(object obj)
 {
     try
     {
         CoreFactory.GetInstance().EmployeeBusinessLogic.UpdateEmployee(this.EmployeeObj);
         NotificationService.ShowInformationMessage("Record has been updated");
     }
     catch (System.Exception e)
     {
         NotificationService.ShowErrorMessage(e.Message);
     }
 }
Example #12
0
        protected override void OnStart(string[] args)
        {
            scheduler = CoreFactory.CreateSchedulerInstance();
            // Create the thread object, passing in the Scheduler.Run method
            // via a ThreadStart delegate. This does not start the thread.
            thread = new Thread(new ThreadStart(scheduler.Run));

            // Start the thread
            thread.Start();

            log.Info("WindowsService gestartet");
        }
Example #13
0
        public TiskarnaVosahlo()
        {
            InitApplicationContext();
            InitUserContext();

            _coreFactory = new CoreFactory();

            _userManagement = _coreFactory.CreateUserManagement();
            _autentication  = _coreFactory.CreateAutentication(_userManagement);

            _paperFormats = new PaperFormats();
        }
Example #14
0
        /// <summary>
        /// Creates a test run object from a text file.
        /// </summary>
        /// <param name="text">The text report to import.</param>
        /// <param name="indentationKey">The string used for indentation in the text file.</param>
        /// <param name="rootNamespace">The namspace to prepend to each capability.</param>
        /// <param name="defaultOutcome">The default outcome for a scenario.</param>
        /// <param name="defaultReason">The default reason for an scenario.</param>
        /// <returns>TestRun object hydrated from the text file outline.</returns>
        public TestRun ImportText(
            string text,
            string indentationKey = "\t",
            string rootNamespace  = "",
            string defaultOutcome = "Skipped",
            string defaultReason  = "Defining")
        {
            if (text.Length == 0)
            {
                throw new Exception("The file is empty.");
            }
            this.indentationKey = indentationKey;
            this.defaultOutcome = (Outcome)Enum.Parse(typeof(Outcome), defaultOutcome);
            this.rootNamespace  = rootNamespace;
            this.defaultReason  = defaultReason;
            string[] lines = text.Split(
                new[] { Environment.NewLine },
                StringSplitOptions.None
                );

            var factory        = new CoreFactory();
            var testRunBuilder = factory.CreateTestRunBuilder(Configuration.TestRunName);

            var currentTestRunBuilder = xB.CurrentRun;

            xB.CurrentRun = testRunBuilder;

            try {
                this.ProcessLines(lines);
            } catch {
                xB.CurrentRun = currentTestRunBuilder;
                throw;
            }
            xB.CurrentRun.TestRun.SortTestRunResults(this.featureNames);
            xB.CurrentRun.TestRun.Scenarios.ForEach(scenario => {
                if (scenario.Outcome == Outcome.NotRun)
                {
                    scenario.Outcome = this.defaultOutcome;
                }
                if (scenario.Reason == null)
                {
                    scenario.Reason = this.defaultReason;
                }
            });
            var testRun = xB.CurrentRun.TestRun;

            xB.CurrentRun = currentTestRunBuilder;
            return(testRun);
        }
Example #15
0
        void Start()
        {
            Dependencies.Inject();
            CoreFactory.GetInstance().InitGlobalRandomNumberGeneratorWithSeed(83457547);

            CoastlineHeightMapGenerator coastlineGenerator = new CoastlineHeightMapGenerator();
            List <BlockPosition>        coastLine          = coastlineGenerator.GenerateCoastline(1024);

            TemperatePlainIslandGenerator islandGenerator = new TemperatePlainIslandGenerator();
            Island testIsland = islandGenerator.GenerateIsland(1024, coastLine);

            StandardIslandPresenter islandPresenter = new StandardIslandPresenter();

            islandPresenter.PresentIsland(testIsland);
        }
		public async void WithSynchronousExecution()
		{
			StringBuilder sb = new StringBuilder();
			sb.AppendLine("Area:");
			sb.AppendLine("My App - API - Test - Features - Calendar");
			sb.AppendLine();
			sb.AppendLine("Feature:");
			sb.AppendLine("Get Holidays");
			sb.AppendLine();
			sb.AppendLine("Feature Description:");
			sb.AppendLine("In order to reference culture specific holidays");
			sb.AppendLine("As a developer");
			sb.AppendLine("I would like to get a list of the current user's culture specific holidays");
			sb.AppendLine();
			sb.AppendLine("Scenario:");
			sb.AppendLine("When US Calendar");
			sb.AppendLine();
			sb.AppendLine("Steps:");
			sb.AppendLine("Given a calendar object is initialized with US holidays");
			sb.AppendLine("When you call GetHolidays with a date range of 3/10/2015 to 3/18/2015");
			sb.AppendLine("Then you should get back a single holiday that is St. Patrick's Day");

			var testRunBuilder = new CoreFactory().CreateTestRunBuilder(null);
            await xB.CurrentRun
                .AddScenario(this)
                .SetOutputWriter(outputWriter)
                .Given(Code.HasTheFollowingScenario("\\Features\\DefineScenarios\\SampleCode\\GetHolidays.cs"))
                .When("the scenario is executed", (s) =>
                {
					var currentTestRun = xB.CurrentRun;
					xB.CurrentRun = testRunBuilder;
                    new MyApp.API.Test.Features.Calendar.GetHolidays().WhenUSCalendar();
					xB.CurrentRun = currentTestRun;
                })
                .Then("the test run will have the following structure", (s) => {
					var steps = s.MultilineParameter.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
					Assert.Equal(steps[1], testRunBuilder.TestRun.Areas[0].Name);
					Assert.Equal(steps[3], testRunBuilder.TestRun.Areas[0].Features[0].Name);
					Assert.Equal(steps[5].Substring(9,steps[5].Length - 9), testRunBuilder.TestRun.Areas[0].Features[0].Value);
					Assert.Equal(steps[6].Substring(5,steps[6].Length - 5), testRunBuilder.TestRun.Areas[0].Features[0].Actor);
					Assert.Equal(steps[7].Substring(16,steps[7].Length - 16), testRunBuilder.TestRun.Areas[0].Features[0].Capability);
					Assert.Equal(steps[9], testRunBuilder.TestRun.Areas[0].Features[0].Scenarios[0].Name);
					Assert.Equal(steps[11], testRunBuilder.TestRun.Areas[0].Features[0].Scenarios[0].Steps[0].FullName);
					Assert.Equal(steps[12], testRunBuilder.TestRun.Areas[0].Features[0].Scenarios[0].Steps[1].FullName);
					Assert.Equal(steps[13], testRunBuilder.TestRun.Areas[0].Features[0].Scenarios[0].Steps[2].FullName);
				}, sb.ToString())
                .Run();
		}
        public static void Main()
        {
            IInputReader        inputReader        = new ConsoleReader();
            IOutputWriter       outputWriter       = new ConsoleWriter();
            IInputOutputManager inputOutputManager = new IOManager(inputReader, outputWriter);

            ICoreIdManager   coreIdManager     = new CoreIdManager();
            ICoreFactory     coreFactory       = new CoreFactory();
            IFragmentFactory fragmentFactory   = new FragmentFactory();
            IPlantController plantController   = new PlantController(coreIdManager, coreFactory, fragmentFactory);
            IInterpreter     commandIntepreter = new CommandInterpreter(plantController);

            IRunnable engine = new Engine(inputOutputManager, commandIntepreter);

            engine.Run();
        }
        // ** CHANGES BELOW ARE NOT REQUIRED UNLESS YOUR ACCESS REQUIRES ADDITIONAL PARAMETERS **

        // GetSession
        // Based on the above Session Type, retrieve the Session used to define how you want to access the platform.
        //
        public static ISession GetSession(bool overrideWebSocketIfNecessary = true)
        {
            if (overrideWebSocketIfNecessary)
            {
                // Note:
                // The default RDP Library for .NET WebSocket implementation is based on Microsoft's WebSocketClient.  This implementation
                // is only available on Windows 8 and above or if an application targets .NET Core 2.1 or greater.  Because all example
                // applications within this package are built using .NET Framework 4.5.2, if the Windows OS is anything less than Windows 8,
                // the WebSocket4Net implementation will be used.
                var ver = Environment.OSVersion.Version;
                if (ver.Major <= 6 && ver.Minor <= 1)
                {
                    DeliveryFactory.RegisterWebSocket(DeliveryFactory.WebSocketImpl.WebSocket4Net);
                }
            }

            switch (SessionType)
            {
            case SessionTypeEnum.RDP:
                return(CoreFactory.CreateSession(new PlatformSession.Params()
                                                 .WithOAuthGrantType(new GrantPassword().UserName(Credentials.RDPUser)
                                                                     .Password(Credentials.RDPPassword))
                                                 .AppKey(Credentials.AppKey)
                                                 .WithTakeSignonControl(true)
                                                 .OnState((s, state, msg) => Console.WriteLine($"{DateTime.Now}:{msg}. (State: {state})"))
                                                 .OnEvent((s, eventCode, msg) => Console.WriteLine($"{DateTime.Now}:{msg}. (Event: {eventCode})"))));

            case SessionTypeEnum.DEPLOYED:
                return(CoreFactory.CreateSession(new PlatformSession.Params().WithHost(Credentials.TREPHost)
                                                 .OnState((s, state, msg) => Console.WriteLine($"{DateTime.Now}: State: {state}. {msg}"))
                                                 .OnEvent((s, eventCode, msg) => Console.WriteLine($"{DateTime.Now}: Event: {eventCode}. {msg}"))));

            case SessionTypeEnum.DESKTOP:
                return(CoreFactory.CreateSession(new DesktopSession.Params().AppKey(Credentials.AppKey)
                                                 .OnState((s, state, msg) => Console.WriteLine($"{DateTime.Now}:{msg}. (State: {state})"))
                                                 .OnEvent((s, eventCode, msg) => Console.WriteLine($"{DateTime.Now}:{msg}. (Event: {eventCode})"))));

            case SessionTypeEnum.DEPLOYED_DEPRECATED:
                return(CoreFactory.CreateSession(new DeployedPlatformSession.Params().Host(Credentials.TREPHost)
                                                 .OnState((s, state, msg) => Console.WriteLine($"{DateTime.Now}:{msg}. (State: {state})"))
                                                 .OnEvent((s, eventCode, msg) => Console.WriteLine($"{DateTime.Now}:{msg}. (Event: {eventCode})"))));

            default:
                throw new IndexOutOfRangeException($"Unknown Session Type: {SessionType}");
            }
        }
Example #19
0
        static void Main(string[] args)
        {
            var list = new List <CoreControler>();

            for (int i = 0; i < 1; i++)
            {
                var controler = CoreFactory.Create();
                controler.Initialize(new CoreConfiguration()
                {
                    Name = "Test Core " + i
                });
                list.Add(controler);
            }
            list.ForEach(i => Console.WriteLine(i));
            list.ForEach(i => i.Dispose());
            Console.WriteLine("END");
            Console.ReadLine();
        }
Example #20
0
        public async Task AllPassing()
        {
            var factory = new CoreFactory();

            xB.CurrentRun = factory.CreateTestRunBuilder("Test Run");
            var tr = await TestRunSetup.BuildTestRun();

            var reasons = new List <string>()
            {
                "Removing",
                "Building",
                "Untested",
                "Ready",
                "Defining"
            };

            xB.CurrentRun.TestRun.UpdateParentReasonsAndStats(reasons);
            this.ValidateTestResuls(tr);
        }
Example #21
0
        public Grammar(string name)
            : base(name)
        {
            OptionList = new OptionList();
            Options    = new OptionsMaker(this);

            Terminals    = new TerminalList();
            Nonterminals = new NonterminalList();

            Productions = new List <Production>();

            LR0Sets = new LR0SetSet();
            LR1Sets = new LR1SetSet();

            Dfas       = Array.Empty <FA>();
            StateToDfa = Array.Empty <int>();
            SpacingDfa = FA.None();

            CoreFactory = new CoreFactory();
        }
Example #22
0
        public async Task AllPassing()
        {
            var factory = new CoreFactory();

            xB.CurrentRun = factory.CreateTestRunBuilder("Test Run");
            var tr = await TestRunSetup.BuildTestRun();

            var reasons = new List <string>()
            {
                "Removing",
                "Building",
                "Untested",
                "Ready",
                "Defining"
            };
            var features = new List <string>()
            {
            };

            xB.Complete("xBDDConfig.json", features, (message) => { Logger.LogMessage(message); });
        }
Example #23
0
        private static ISession _OpenSession(string databaseId)
        {
            try
            {
                var                 info   = ORMConfig.ORMConfiguration.GetDatabaseInfo(databaseId);
                IDbConnection       cnn    = CoreFactory.CreateDbProvider(databaseId).CreateConnection(info.ConnectString);
                ISQLExecutor        exe    = new SQLExecutor(databaseId, cnn);
                IObjectMapInfoCache cache  = CoreFactory.ObjectMapInfoCache;
                IEntityManager      mgr    = new EntityManager(exe, CoreFactory.CreateDialectProvider(databaseId).CreateMappingSQLEmit(cache));
                IEntityQuery        qry    = new EntityQuery(exe, CoreFactory.CreateDialectProvider(databaseId).CreateQuerySQLEmit(cache));
                INativeSQL          native = new NativeSQL(exe);

                if (cnn.State != ConnectionState.Open)
                {
                    cnn.Open();
                }

                return(new SimpleSession(exe, mgr, qry, native));
            }
            catch (Exception ex)
            {
                throw ex.CreateWrapException <SessionException>();
            }
        }
 public static String PHASE_PROPERTY_FEEDBACK()
 {
     return(CoreFactory.createString("feedback"));
 }
 public static String PHASE_PROPERTY_LIVE()
 {
     return(CoreFactory.createString("live"));
 }
 public EmployeeWindowViewModel()
 {
     this.Employees = new ObservableCollection <Employee>(CoreFactory.GetInstance().EmployeeBusinessLogic.GetAllEmployees());
     this._updateEmployeeCommand = new RelayCommand(this.UpdateEmployeeReferenece);
 }
		public async void WithAsynchronousExecution()
		{
			StringBuilder sb = new StringBuilder();
			sb.AppendLine("Area:");
			sb.AppendLine("My App - API - Test - Features - Accounts");
			sb.AppendLine();
			sb.AppendLine("Feature:");
			sb.AppendLine("Get Account Details");
			sb.AppendLine();
			sb.AppendLine("Scenario:");
			sb.AppendLine("When Unauthenticated");
			sb.AppendLine();
			sb.AppendLine("Steps:");
			sb.AppendLine("Given the client is not authenticated");
			sb.AppendLine("When the client gets to the account details resource 'http://<site>/api/Accounts/99'");
			sb.AppendLine("Then the client should get a 401 response");

			var testRunBuilder = new CoreFactory().CreateTestRunBuilder(null);
            await xB.CurrentRun
                .AddScenario(this)
                .SetOutputWriter(outputWriter)
                .Given(Code.HasTheFollowingScenario("\\Features\\DefineScenarios\\SampleCode\\GetAccountDetails.cs"))
                .WhenAsync("the scenario is excuted", async (s) =>
                {
					var currentTestRun = xB.CurrentRun;
					xB.CurrentRun = testRunBuilder;
                    await new MyApp.API.Test.Features.Accounts.GetAccountDetails().WhenUnauthenticated();
					xB.CurrentRun = currentTestRun;
                })
                .Then("the test run will have the following structure", (s) => {
					var steps = s.MultilineParameter.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
					Assert.Equal(steps[1], testRunBuilder.TestRun.Areas[0].Name);
					Assert.Equal(steps[3], testRunBuilder.TestRun.Areas[0].Features[0].Name);
					Assert.Equal(steps[5], testRunBuilder.TestRun.Areas[0].Features[0].Scenarios[0].Name);
					Assert.Equal(steps[7], testRunBuilder.TestRun.Areas[0].Features[0].Scenarios[0].Steps[0].FullName);
					Assert.Equal(steps[8], testRunBuilder.TestRun.Areas[0].Features[0].Scenarios[0].Steps[1].FullName);
					Assert.Equal(steps[9], testRunBuilder.TestRun.Areas[0].Features[0].Scenarios[0].Steps[2].FullName);
				}, sb.ToString())
                .Run();
		}
 public static String PHASE_PROPERTY_ARRIVED()
 {
     return(CoreFactory.createString("arrived"));
 }
 public static String PHASE_PROPERTY_NOT_COMPLETED()
 {
     return(CoreFactory.createString("not_completed"));
 }
Example #30
0
        static void Main(string[] args)
        {
            Console.WriteLine("Start retrieving MRN Story data. Press Ctrl+C to exit");
            // Set RDP.NET Logger level to Trace
            Log.Level = NLog.LogLevel.Trace;
            FileStream   fileStream   = null;
            StreamWriter streamWriter = null;
            var          @out         = Console.Out;

            if (redirectOutputToFile)
            {
                Console.WriteLine("Redirect Output to file Output.txt");
                try
                {
                    fileStream   = new FileStream("./Output.txt", FileMode.OpenOrCreate, FileAccess.Write);
                    streamWriter = new StreamWriter(fileStream);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Cannot open Output.txt for writing");
                    Console.WriteLine(e.Message);
                    return;
                }
                Console.SetOut(streamWriter);
                @out = Console.Out;
            }

            ISession session;

            if (!useRDP)
            {
                System.Console.WriteLine("Start Deployed PlatformSession");
                session = CoreFactory.CreateSession(new DeployedPlatformSession.Params()
                                                    .Host(WebSocketHost)
                                                    .WithDacsUserName(TREPUser)
                                                    .WithDacsApplicationID(appID)
                                                    .WithDacsPosition(position)
                                                    .OnState((s, state, msg) =>
                {
                    Console.WriteLine($"{DateTime.Now}:  {msg}. (State: {state})");
                    _sessionState = state;
                })
                                                    .OnEvent((s, eventCode, msg) => Console.WriteLine($"{DateTime.Now}: {msg}. (Event: {eventCode})")));
            }
            else
            {
                System.Console.WriteLine("Start RDP PlatformSession");
                session = CoreFactory.CreateSession(new PlatformSession.Params()
                                                    .OAuthGrantType(new GrantPassword().UserName(RDPUser)
                                                                    .Password(RDPPassword))
                                                    .AppKey(RDPAppKey)
                                                    .WithTakeSignonControl(true)
                                                    .OnState((s, state, msg) =>
                {
                    Console.WriteLine($"{DateTime.Now}:  {msg}. (State: {state})");
                    _sessionState = state;
                })
                                                    .OnEvent((s, eventCode, msg) => Console.WriteLine($"{DateTime.Now}: {msg}. (Event: {eventCode})")));
            }
            session.Open();
            if (_sessionState == Session.State.Opened)
            {
                System.Console.WriteLine("Session is now Opened");
                System.Console.WriteLine("Sending MRN_STORY request");
                using var mrnNews = ContentFactory.CreateMachineReadableNews(new MachineReadableNews.Params()
                                                                             .Session(session)
                                                                             .WithNewsDatafeed("MRN_STORY")
                                                                             .OnError((e, msg) => Console.WriteLine(msg))
                                                                             .OnStatus((e, msg) => Console.WriteLine(msg))
                                                                             .OnNews((e, msg) => ProcessNewsContent(msg)));
                mrnNews.Open();
                Thread.Sleep(runtime);
            }

            if (redirectOutputToFile)
            {
                streamWriter?.Close();
                if (fileStream != null)
                {
                    fileStream.Close();
                }
            }

            Console.WriteLine("Stop and Quit the applicaiton");
        }
        public List <Shift> GetAllShifts()
        {
            List <Shift> allShifts = CoreFactory.GetInstance().ShiftBusinessLogic.GetAllShifts();

            return(allShifts);
        }
 public void TestCaseInit()
 {
     m_CoreFactory = new CoreFactory();
     m_NHibernateService = m_CoreFactory.GetNHibernateService();
 }
        public Shift GetShift(string shiftID)
        {
            Shift shift = CoreFactory.GetInstance().ShiftBusinessLogic.GetShift(Int32.Parse(shiftID));

            return(shift);
        }