public void CodePackageActivationContextTest_GetServiceManifestTest()
        {
            ServiceManifestInfo manifest = ServiceManifestTest.HelperInstance.CreateDefaultInfo();

            var context = CodePackageActivationContext.CreateFromNative(new CodePackageActivationContextStub()
            {
                ServiceManifestInfo_Internal = manifest,
                CodePackageName_Internal     = manifest.CodePackages.ElementAt(0).Name
            });

            ServiceManifestTest.HelperInstance.Compare(ServiceManifestTest.HelperInstance.CreateDefaultDescription(), ServiceManifest.CreateFromCodePackageActivationContext(context));
        }
        private static void SimplePropertiesOnContextObjectTest(
            Action <CodePackageActivationContextStub, string> setter,
            Func <CodePackageActivationContext, string> getter)
        {
            const string text = "abc";
            var          stub = new CodePackageActivationContextStub();

            setter(stub, text);

            var context = CodePackageActivationContext.CreateFromNative(stub);

            Assert.AreEqual(text, getter(context));
        }
        public void ActivateCodePackage(string activationContextId, string codePackageNameToActivate, IntPtr nativeCodePackageActivationContext, IntPtr nativeFabricRuntime)
        {
            this.ThrowIfDisposed();

            // thunk down to ActivateCodePackageInternal
            // this is for testing purposes only
            // all this method does is take the IntPtr codePackageActivationContext and unmarshal it
            AppTrace.TraceSource.WriteInfo("FabricEntryPoint.ActivateCodePackage", "Activating {0} with index {1}", activationContextId, codePackageNameToActivate);

            try
            {
                this.ActivateCodePackageInternal(
                    activationContextId,
                    codePackageNameToActivate,
                    CodePackageActivationContext.CreateFromNative((NativeRuntime.IFabricCodePackageActivationContext6)Marshal.GetObjectForIUnknown(nativeCodePackageActivationContext)),
                    (NativeRuntime.IFabricRuntime)Marshal.GetObjectForIUnknown(nativeFabricRuntime));
            }
            catch (Exception e)
            {
                AppTrace.TraceSource.WriteExceptionAsError("HostEntryPoint.ActivateCodePackage", e);
                throw;
            }
        }
示例#4
0
 private CodePackageActivationContext GetCodePackageActivationContextEndWrapper(NativeCommon.IFabricAsyncOperationContext context)
 {
     return(CodePackageActivationContext.CreateFromNative(NativeRuntime.FabricEndGetActivationContext(context)));
 }
示例#5
0
            private CodePackageActivationContext GetCodePackageActivationContextHelper()
            {
                Guid iid = typeof(NativeRuntime.IFabricCodePackageActivationContext6).GetTypeInfo().GUID;

                return(CodePackageActivationContext.CreateFromNative(NativeRuntime.FabricGetActivationContext(ref iid)));
            }