Esempio n. 1
0
 public void TestPatchPool_ThrowsOnUnbound()
 {
     using (BatchClient client = ClientUnitTestCommon.CreateDummyClient())
     {
         CloudPool pool = client.PoolOperations.CreatePool();
         Assert.Throws <InvalidOperationException>(() => pool.CommitChanges());
     }
 }
Esempio n. 2
0
        private static void CommonPatchPoolTest(
            Protocol.Models.CloudPool startEntity,
            Action <CloudPool> modificationFunction,
            Action <Protocol.Models.PoolPatchParameter> assertAction)
        {
            using (BatchClient client = ClientUnitTestCommon.CreateDummyClient())
            {
                CloudPool pool = client.PoolOperations.GetPool(
                    string.Empty,
                    additionalBehaviors: InterceptorFactory.CreateGetPoolRequestInterceptor(startEntity));

                modificationFunction(pool);

                var patchInterceptor = ShimPatchPool(assertAction);
                pool.CommitChanges(additionalBehaviors: new[] { patchInterceptor });

                //Ensure that the job is in readable but unmodifiable state
                var id = pool.Id;
                Assert.Throws <InvalidOperationException>(() => pool.Metadata = null);
            }
        }