Exemplo n.º 1
0
 public MemorySessionFactoryTest()
 {
     Options       = new BoltServerOptions();
     SesionHandler = new Mock <IServerSessionHandler>(MockBehavior.Loose);
     Subject       = new MemorySessionFactory(Options, SesionHandler.Object);
     Instance      = new InstanceInternal();
 }
        private void OnXmlFileDropped(string file)
        {
            if (this.DatabaseRelease.Images.Count != 0 || this.DatabaseRelease.AdditionalFiles.Count != 0)
            {
                if (!Dialogs.Confirm("This will replace all images, additional files and other data. Continue?"))
                {
                    return;
                }
            }

            WaitWindow waitWindow = new WaitWindow("Reading release data...");

            waitWindow.ShowDialog(this, () =>
            {
                var tempFactory = new MemorySessionFactory();
                var tempManager = tempFactory.CreateCollectionManager();

                using (XmlReleaseImporter xmlReleaseImporter = new XmlReleaseImporter(file, tempManager))
                {
                    Release release = xmlReleaseImporter.ImportRelease();

                    this.Dispatcher.InvokeAction(() =>
                    {
                        this.LoadDataFromRelease(release, tempManager.ImageHandler);

                        tempManager.Dispose();
                        tempFactory.Dispose();
                    });
                }
            });
        }
Exemplo n.º 3
0
 protected override void Configure(IApplicationBuilder appBuilder)
 {
     appBuilder.UseBolt(h =>
     {
         Factory = new MemorySessionFactory(h.Configuration.Options);
         IContractInvoker contract = h.UseSession <ITestContractStateFull, TestContractStateFull>(Factory);
         InstanceProvider          = (SessionInstanceProvider)contract.InstanceProvider;
     });
 }
Exemplo n.º 4
0
            public ExportTester(ICollectionManager collectionManager)
                : base(collectionManager)
            {
                this.factory          = new MemorySessionFactory();
                this.memoryCollection = this.factory.CreateCollectionManager();

                this.releaseComparer = new ReleaseEqualityComparer(true);
                this.importTester    = new ImportTester(this.memoryCollection);
            }
Exemplo n.º 5
0
        public static IContractInvoker UseMemorySession <TContract, TContractImplementation>(
            this IBoltRouteHandler bolt,
            Action <ConfigureContractContext> configure = null) where TContractImplementation : TContract
        {
            var config  = new ServerRuntimeConfiguration(bolt.Configuration);
            var factory = new MemorySessionFactory(
                config,
                bolt.ApplicationServices.GetRequiredService <IServerSessionHandler>(),
                bolt.ApplicationServices.GetRequiredService <ILoggerFactory>());

            return(bolt.Use <TContract>(InstanceProvider.Session.From <TContractImplementation>(factory), configure, config));
        }
Exemplo n.º 6
0
 private MockSessionInstanceProvider(MockContractDescriptor contract, Mock <IInstanceProviderActions> actions, MemorySessionFactory factory) : base(factory)
 {
     _factory = factory;
     _actions = actions;
 }