Ejemplo n.º 1
0
        public void FabricRuntime_GetActivationContext_ReturnsCorrectValueFromNativeCode()
        {
            var stub = new FabricRuntimeFactoryStub
            {
                CodePackageActivationContextToReturn = FabricRuntimeTest.DefaultCodePackageActivationContext
            };

            FabricRuntime.FabricRuntimeFactory = stub;
            Assert.AreSame(stub.CodePackageActivationContextToReturn, FabricRuntime.GetActivationContext());
        }
Ejemplo n.º 2
0
        public void FabricRuntime_GetActivationContext()
        {
            var stub = new FabricRuntimeFactoryStub();

            var context = FabricRuntimeTest.DefaultCodePackageActivationContext;

            stub.CodePackageActivationContextToReturn = context;

            FabricRuntime.FabricRuntimeFactory = stub;
            Assert.AreSame(context, FabricRuntime.GetActivationContext());
        }
Ejemplo n.º 3
0
        private void SuccessfulCreateTestHelper(Action <FabricRuntimeFactoryStub> setup, Func <FabricRuntimeFactoryStub, FabricRuntime> creationFunc, Action <FabricRuntime, FabricRuntimeFactoryStub> validation = null)
        {
            // setup the objects
            var stub = new FabricRuntimeFactoryStub();

            setup(stub);

            FabricRuntime.FabricRuntimeFactory = stub;

            // create should succeed
            FabricRuntime runtime = creationFunc(stub);

            Assert.IsNotNull(runtime);

            // the guid should match the FabricRuntime Guid
            Assert.AreEqual <Guid>(typeof(NativeRuntime.IFabricRuntime).GUID, stub.GuidReceived);

            if (validation != null)
            {
                validation(runtime, stub);
            }
        }
Ejemplo n.º 4
0
 private void CreateValidation(uint timeoutExpected, CodePackageActivationContext contextExpected, FabricRuntime runtime, FabricRuntimeFactoryStub stub)
 {
     Assert.AreEqual <uint>(timeoutExpected, stub.TimeoutReceived);
     Assert.AreSame(contextExpected, runtime.CodePackageActivationContext);
 }