internal CreationData(DiskCreateOption createOption, string storageAccountId, ImageDiskReference imageReference, ImageDiskReference galleryImageReference, string sourceUri, string sourceResourceId, string sourceUniqueId, long?uploadSizeBytes) { CreateOption = createOption; StorageAccountId = storageAccountId; ImageReference = imageReference; GalleryImageReference = galleryImageReference; SourceUri = sourceUri; SourceResourceId = sourceResourceId; SourceUniqueId = sourceUniqueId; UploadSizeBytes = uploadSizeBytes; }
internal CreationData(DiskCreateOption createOption, string storageAccountId, ImageDiskReference imageReference, ImageDiskReference galleryImageReference, string sourceUri, string sourceResourceId, string sourceUniqueId, long?uploadSizeBytes, int?logicalSectorSize, string securityDataUri) { CreateOption = createOption; StorageAccountId = storageAccountId; ImageReference = imageReference; GalleryImageReference = galleryImageReference; SourceUri = sourceUri; SourceResourceId = sourceResourceId; SourceUniqueId = sourceUniqueId; UploadSizeBytes = uploadSizeBytes; LogicalSectorSize = logicalSectorSize; SecurityDataUri = securityDataUri; }
private void Validate(Snapshot snapshotExpected, Snapshot snapshotActual, bool diskHydrated = false, bool incremental = false) { // snapshot resource Assert.AreEqual(string.Format("{0}/{1}", ApiConstants.ResourceProviderNamespace, "snapshots"), snapshotActual.Type); Assert.NotNull(snapshotActual.Name); Assert.AreEqual(DiskRPLocation, snapshotActual.Location); // snapshot properties Assert.AreEqual(snapshotExpected.Sku.Name, snapshotActual.Sku.Name); Assert.True(snapshotActual.ManagedBy == null); Assert.NotNull(snapshotActual.ProvisioningState); Assert.AreEqual(incremental, snapshotActual.Incremental); Assert.NotNull(snapshotActual.CreationData.SourceUniqueId); if (snapshotExpected.OsType != null) //these properties are not mandatory for the client { Assert.AreEqual(snapshotExpected.OsType, snapshotActual.OsType); } if (snapshotExpected.DiskSizeGB != null) { // Disk resizing Assert.AreEqual(snapshotExpected.DiskSizeGB, snapshotActual.DiskSizeGB); } // Creation data CreationData creationDataExp = snapshotExpected.CreationData; CreationData creationDataAct = snapshotActual.CreationData; Assert.AreEqual(creationDataExp.CreateOption, creationDataAct.CreateOption); Assert.AreEqual(creationDataExp.SourceUri, creationDataAct.SourceUri); Assert.AreEqual(creationDataExp.SourceResourceId, creationDataAct.SourceResourceId); Assert.AreEqual(creationDataExp.StorageAccountId, creationDataAct.StorageAccountId); // Image reference ImageDiskReference imgRefExp = creationDataExp.GalleryImageReference ?? creationDataExp.ImageReference; ImageDiskReference imgRefAct = creationDataAct.GalleryImageReference ?? creationDataAct.ImageReference; if (imgRefExp != null) { Assert.AreEqual(imgRefExp.Id, imgRefAct.Id); Assert.AreEqual(imgRefExp.Lun, imgRefAct.Lun); } else { Assert.Null(imgRefAct); } }
protected void Validate(Disk diskExpected, Disk diskActual, string location, bool diskHydrated = false, bool update = false) { // disk resource Assert.AreEqual(string.Format("{0}/{1}", ApiConstants.ResourceProviderNamespace, "disks"), diskActual.Type); Assert.NotNull(diskActual.Name); Assert.AreEqual(location, diskActual.Location); // disk properties Assert.AreEqual(diskExpected.Sku.Name, diskActual.Sku.Name); Assert.NotNull(diskActual.ProvisioningState); Assert.AreEqual(diskExpected.OsType, diskActual.OsType); Assert.NotNull(diskActual.UniqueId); if (diskExpected.DiskSizeGB != null) { // Disk resizing Assert.AreEqual(diskExpected.DiskSizeGB, diskActual.DiskSizeGB); Assert.NotNull(diskActual.DiskSizeBytes); } if (!update) { if (diskExpected.DiskIopsReadWrite != null) { Assert.AreEqual(diskExpected.DiskIopsReadWrite, diskActual.DiskIopsReadWrite); } if (diskExpected.DiskMBpsReadWrite != null) { Assert.AreEqual(diskExpected.DiskMBpsReadWrite, diskActual.DiskMBpsReadWrite); } if (diskExpected.DiskIopsReadOnly != null) { Assert.AreEqual(diskExpected.DiskIopsReadOnly, diskActual.DiskIopsReadOnly); } if (diskExpected.DiskMBpsReadOnly != null) { Assert.AreEqual(diskExpected.DiskMBpsReadOnly, diskActual.DiskMBpsReadOnly); } if (diskExpected.MaxShares != null) { Assert.AreEqual(diskExpected.MaxShares, diskActual.MaxShares); } } // Creation data CreationData creationDataExp = diskExpected.CreationData; CreationData creationDataAct = diskActual.CreationData; Assert.AreEqual(creationDataExp.CreateOption, creationDataAct.CreateOption); Assert.AreEqual(creationDataExp.SourceUri, creationDataAct.SourceUri); Assert.AreEqual(creationDataExp.SourceResourceId, creationDataAct.SourceResourceId); Assert.AreEqual(creationDataExp.StorageAccountId, creationDataAct.StorageAccountId); // Image reference ImageDiskReference imgRefExp = creationDataExp.GalleryImageReference ?? creationDataExp.ImageReference; ImageDiskReference imgRefAct = creationDataAct.GalleryImageReference ?? creationDataAct.ImageReference; if (imgRefExp != null) { Assert.AreEqual(imgRefExp.Id, imgRefAct.Id); Assert.AreEqual(imgRefExp.Lun, imgRefAct.Lun); } else { Assert.Null(imgRefAct); } // Zones IList <string> zonesExp = diskExpected.Zones; IList <string> zonesAct = diskActual.Zones; if (zonesExp != null) { Assert.AreEqual(zonesExp.Count, zonesAct.Count); foreach (string zone in zonesExp) { ////TODO //Assert.Contains(zone, zonesAct.First()); //Assert.Contains(zone, zonesAct, StringComparer.OrdinalIgnoreCase); } } else { Assert.Null(zonesAct); } }