コード例 #1
0
        public BaseHandlerIntegrationTest()
        {
            var _applicationConfiguration = new ApplicationConfiguration();
            var configurationRoot         = TestHelper.GetConfigurationRoot(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

            configurationRoot.Bind(_applicationConfiguration);

            var consoleWriter    = new ConsoleWriter(SerilogFixture.UsefullLogger <ConsoleWriter>());
            var authTokenFactory = new OAuthTokenFactory(SerilogFixture.UsefullLogger <OAuthTokenFactory>(), _applicationConfiguration);
            var clientFactory    = new ClientProxyFactory(SerilogFixture.UsefullLogger <ClientProxyFactory>(), authTokenFactory, _applicationConfiguration);
            //var fileHandler = new FileHandlerMock() {ReadFile = FileHandlerMock.WithReadFileAsNoOp(), WriteFile = FileHandlerMock.WithWriteFileAsNoOp()}.Build();
            var fileHandler = new FileHandler(SerilogFixture.UsefullLogger <FileHandler>());

            SchemaClient = clientFactory.GetClientProxy <ISquidexAppSchemaClient>("aut-developer");
            SchemaImportSystemUnderTest = new SchemaImportHandler(SerilogFixture.UsefullLogger <SchemaImportHandler>(), clientFactory, consoleWriter, null);
            SchemaExportSystemUnderTest = new SchemaExportHandler(SerilogFixture.UsefullLogger <SchemaExportHandler>(), clientFactory, consoleWriter, null);
            SchemaDeleteSystemUnderTest = new SchemaDeleteHandler(SerilogFixture.UsefullLogger <SchemaDeleteHandler>(), clientFactory, consoleWriter, null);
            SchemaListSystemUnderTest   = new SchemaListHandler(SerilogFixture.UsefullLogger <SchemaListHandler>(), clientFactory, consoleWriter, null);
            //var schemaTagHandler = new SchemaTagHandler(SerilogFixture.UsefullLogger<ContentDeleteSystemUnderTest>(), clientFactory, null);

            ContentClient = clientFactory.GetClientProxy <ISquidexContentClient>("aut-developer");
            ContentImportSystemUnderTest = new ContentImportHandler(SerilogFixture.UsefullLogger <ContentImportHandler>(), clientFactory, consoleWriter, null);
            ContentExportSystemUnderTest = new ContentExportHandler(SerilogFixture.UsefullLogger <ContentExportHandler>(), clientFactory, consoleWriter, null);
            ContentDeleteSystemUnderTest = new ContentDeleteHandler(SerilogFixture.UsefullLogger <ContentDeleteHandler>(), clientFactory, consoleWriter, null);
            ContentPostSystemUnderTest   = new ContentPostHandler(SerilogFixture.UsefullLogger <ContentImportHandler>(), clientFactory, consoleWriter, null);

            AttachmentClient = clientFactory.GetClientProxy <ISquidexAttachmentClient>("aut-developer");
            AttachmentImportSystemUnderTest   = new AssetImportHandler(SerilogFixture.UsefullLogger <AssetImportHandler>(), clientFactory, consoleWriter, null);
            AttachmentExportSystemUnderTest   = new AssetExportHandler(SerilogFixture.UsefullLogger <AssetExportHandler>(), clientFactory, consoleWriter, null);
            AttachmentDeleteSystemUnderTest   = new AssetDeleteHandler(SerilogFixture.UsefullLogger <AssetDeleteHandler>(), clientFactory, consoleWriter, null);
            AttachmentListSystemUnderTest     = new AssetListHandler(SerilogFixture.UsefullLogger <AssetListHandler>(), clientFactory, consoleWriter, null);
            AttachmentTagSystemUnderTest      = new AssetTagHandler(SerilogFixture.UsefullLogger <AssetTagHandler>(), clientFactory, consoleWriter, null);
            AssetUpdateContentSystemUnderTest = new AssetUpdateContentHandler(SerilogFixture.UsefullLogger <AssetUpdateContentHandler>(), clientFactory, consoleWriter, null);
        }
コード例 #2
0
 public static async Task <Unit> ImportAsset(AssetImportHandler systemUnderTest, string application, string name, string path, string mimeType = "", string aliasCredentials = "aut-developer")
 {
     return(await systemUnderTest.Handle(new AssetImportRequest()
     {
         AliasCredentials = aliasCredentials,
         Application = application,
         Name = name,
         MimeType = mimeType,
         Path = path
     }, CancellationToken.None));
 }
コード例 #3
0
        public override void OnImportAsset(AssetImportContext ctx)
        {
            Logger.Info("Importing VPX table at {0}...", ctx.assetPath);

            // create root object
            var rootGameObj = new GameObject();
            var importer    = rootGameObj.AddComponent <VpxImporter>();

            // load table
            var table = TableLoader.LoadTable(ctx.assetPath);

            // instantiate asset handler
            var assetHandler = new AssetImportHandler(ctx);

            importer.Import(Path.GetFileName(ctx.assetPath), table, assetHandler);

            ctx.AddObjectToAsset("main obj", rootGameObj);
            ctx.SetMainObject(rootGameObj);

            // select imported object
            Selection.activeObject = rootGameObj;
        }