Esempio n. 1
0
        private Pool GetPool(string masterVersion,string slaveVersion)
        {
            Host master = new Host { uuid = "master", opaque_ref = "master", Connection = mockConnection.Object, software_version = new Dictionary<string, string> { { "product_version", masterVersion } } };
           
            cache.UpdateFrom(mockConnection.Object,
                             new List<ObjectChange>() { new ObjectChange(master.GetType(), "master", master) });

            Pool pool = new Pool { Connection = mockConnection.Object, opaque_ref = "pool", master = new XenRef<Host>(master) };
            //Add pool to the cache
            cache.UpdateFrom(mockConnection.Object,
                             new List<ObjectChange>() { new ObjectChange(pool.GetType(), "pool", pool) });
           
            //Add slave
            Host slave = new Host { uuid = "slave",opaque_ref = "slave", Connection = mockConnection.Object, software_version = new Dictionary<string, string> { { "product_version", slaveVersion } } };
            cache.UpdateFrom(mockConnection.Object,
                             new List<ObjectChange>() { new ObjectChange(slave.GetType(), "slave", slave) });

            mockConnection.Setup(x => x.Resolve(new XenRef<Host>("master"))).Returns(master);
            return pool;
        }