コード例 #1
0
        public static void Main()
        {
            var customerDetails = new CustomerDetailsRepository();

            customerDetails.Save(new CustomerDetails(1, "John Doe", new Address("123, Paradise Lost", "Homer Street")));
            customerDetails.Save(new CustomerDetails(2, "Jane Doe", new Address("123, Odyssey House", "Homer Stret")));
            customerDetails.Save(new CustomerDetails(3, "Joe Black", new Address("123, Heven Lodge", "Mitch Street")));
            customerDetails.Save(new CustomerDetails(4, "Raymond Red", new Address("123, Obelix Court", "Renaissance Walk")));

            var orderRepository = new PurchaseOrderRepository();

            orderRepository.Save(new PurchaseOrder(1, new List <ILineItem> {
                new PhysicalProduct("Man In Black", 5.0m), new PhysicalProduct("Fifth Season", 6.0m)
            }, 1, false));
            orderRepository.Save(new PurchaseOrder(4, new List <ILineItem> {
                new PhysicalProduct("Grey's Anatomy", 5.0m), new Membership("Video Club", 6.0m)
            }, 2, false));
            orderRepository.Save(new PurchaseOrder(2, new List <ILineItem> {
                new Membership("Book Club", 5.0m), new PhysicalProduct("Fifth Season", 6.0m)
            }, 3, false));
            orderRepository.Save(new PurchaseOrder(3, new List <ILineItem> {
                new PhysicalProduct("The Theory of Everything", 5.0m), new PhysicalProduct("Space Odyssey", 6.0m)
            }, 4, false));

            var bus = Bootstrap.Boot(orderRepository, customerDetails);

            for (int i = 0; i < 4; i++)
            {
                bus.Execute(new ProcessOrder(i + 1));
            }
        }
コード例 #2
0
ファイル: Global.cs プロジェクト: phiree/Quartz2Demo
    void Application_Start(object sender, EventArgs e)
    {
        Bootstrap.Boot();
        log4net.Config.XmlConfigurator.Configure();
        IScheduler s = Bootstrap.Container.Resolve <IScheduler>();

        s.Start();
    }
コード例 #3
0
        public void IndexKeywordsTest()
        {
            Helper.Form = new Form1();
            Bootstrap.Boot();

            Keywords.Keyword.GetInstance().Map();

            Assert.IsTrue(Keywords.Keyword.GetInstance().KeywordsLoaded);
        }
コード例 #4
0
        public void ScanTest()
        {
            //IEvent events = Event.GetInstance();
            Helper.Form = new Form1();
            Bootstrap.Boot();
            string eventLocation = null;

            Zip.ExtractZip("C:\\Users\\marti\\Desktop\\DESKTOP-NPASAR7 (2018-06-26 10 11).zip", ref eventLocation);

            Assert.IsNotNull(eventLocation);
        }
コード例 #5
0
        public void IndexExtvTest()
        {
            IEvent events = Event.GetInstance();

            Helper.Form = new Form1();
            Bootstrap.Boot();

            events.SetLocation("C:\\Users\\marti\\Desktop\\eventlogs.evtx");

            events.MapEvents();

            Assert.IsTrue(events.Eventlogs.Count > 0 && events.Events.Count > 0);
        }
コード例 #6
0
        public void IndexTest()
        {
            IEvent events = Event.GetInstance();

            Helper.Form = new Form1();
            Bootstrap.Boot();

            events.SetLocation("G:\\Documents\\Visual Studio 2015\\Projects\\EventFilter\\EventFilter\\bin\\Debug\\eventlog.txt");

            events.MapEvents();

            Assert.IsTrue(events.Eventlogs.Count > 0 && events.Events.Count > 0);
        }
コード例 #7
0
        public virtual void SetUp()
        {
            // create testing client application
            ClientApp = new ClientApplication(
                UnisavePreferences.LoadOrCreate()
                );

            // prepare environment
            var env = new EnvStore();

            DownloadEnvFile(env);

            // create testing backend application
            App = Bootstrap.Boot(
                GetGameAssemblyTypes(),
                env,
                new SpecialValues()
                );

            // execute backend code locally
            ClientApp.Singleton <FacetCaller>(
                _ => new TestingFacetCaller(App, ClientApp)
                );

            // logging should go direct, we don't want to wait for app disposal
            // for writing logs to special values
            // HACK: this is a hack, see the ClientSideLog class for more
            App.Singleton <ILog>(_ => new ClientSideLog());

            // bind facades
            Facade.SetApplication(App);
            ClientFacade.SetApplication(ClientApp);

            // start with a blank slate
            ClientApp.Resolve <ClientSessionIdRepository>().StoreSessionId(null);
            ClearDatabase();
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: Bojidarist/AutoSharp
        static void Main(string[] args)
        {
            Bootstrap.Boot();

            System.Console.ReadKey();
        }
コード例 #9
0
        protected override IPromise <JsonValue> PerformFacetCall(
            string facetName,
            string methodName,
            JsonArray arguments
            )
        {
            var env = new Env();

            // override with additional dev configuration
            var preferences = UnisavePreferences.LoadOrCreate();

            if (preferences.DevelopmentEnv != null)
            {
                var overrideEnv = Env.Parse(preferences.DevelopmentEnv.text);
                env.OverrideWith(overrideEnv);
            }

            var app = Bootstrap.Boot(
                GetGameAssemblyTypes(),
                env,
                new SpecialValues()
                );

            Facade.SetApplication(app);

            PerformContainerSurgery(app);

            JsonValue returnedJson;

            try
            {
                // BEGIN RUN THE APP

                var methodParameters = new FacetCallKernel.MethodParameters(
                    facetName,
                    methodName,
                    arguments,
                    SessionId
                    );

                var kernel = app.Resolve <FacetCallKernel>();

                returnedJson = kernel.Handle(methodParameters);

                // END RUN THE APP
            }
            finally
            {
                SaveDatabase();

                Facade.SetApplication(null);

                var specialValues = app.Resolve <SpecialValues>();

                app.Dispose();

                SessionId = specialValues.Read("sessionId").AsString;
                LogPrinter.PrintLogsFromFacetCall(specialValues.Read("logs"));

                OnFacetCalled?.Invoke();
            }

            return(Promise <JsonValue> .Resolved(returnedJson));
        }
コード例 #10
0
 public void FilesFoundTest()
 {
     Helper.Form = new Form1();
     Bootstrap.Boot();
     Assert.IsTrue(Bootstrap.AreFilesFound);
 }
コード例 #11
0
        /// <summary>
        /// Main entrypoint to the framework execution
        /// Given executionParameters it starts some action which results.
        /// in a returned value or an exception.
        ///
        /// Input and output are serialized as JSON strings.
        /// </summary>
        public static string Start(
            string executionParametersAsJson,
            Type[] gameAssemblyTypes
            )
        {
            if (someExecutionIsRunning)
            {
                throw new InvalidOperationException(
                          "You cannot start the framework from within the framework."
                          );
            }

            someExecutionIsRunning = true;

            var executionStopwatch = Stopwatch.StartNew();

            try
            {
                PrintGreeting();

                var executionParameters = ExecutionParameters
                                          .Parse(executionParametersAsJson);

                var specialValues = new SpecialValues();

                JsonObject result = HandleExceptionSerialization(
                    specialValues,
                    () => {
                    // NOTE: this place is where a test/emulation
                    // is started. Simply boot the application and
                    // then directly call proper kernel (method handler).

                    var env = EnvStore.Parse(executionParameters.EnvSource);

                    JsonValue methodResult;

                    using (var app = Bootstrap.Boot(
                               gameAssemblyTypes,
                               env,
                               specialValues
                               ))
                    {
                        Facade.SetApplication(app);

                        methodResult = ExecuteProperMethod(
                            executionParameters,
                            app
                            );

                        Facade.SetApplication(null);
                    }

                    return(new JsonObject()
                           .Add("result", "ok")
                           .Add("returned", methodResult)
                           .Add("special", specialValues.ToJsonObject()));
                }
                    );

                executionStopwatch.Stop();
                result["special"].AsJsonObject["executionDuration"]
                    = executionStopwatch.ElapsedMilliseconds / 1000.0;

                return(result.ToString());
            }
            finally
            {
                someExecutionIsRunning = false;
            }
        }