private void ValidateVnet(VNet RemoteAppVnet) { AssertNotNullOrEmpty(RemoteAppVnet.Region); AssertNotNullOrEmpty(RemoteAppVnet.Name); AssertNotNullOrEmpty(RemoteAppVnet.VnetAddressSpaces); if (!string.Equals(RemoteAppVnet.Name, "cloudvnet", StringComparison.OrdinalIgnoreCase)) { AssertNotNullOrEmpty(RemoteAppVnet.LocalAddressSpaces); AssertNotNullOrEmpty(RemoteAppVnet.DnsServers); } }
public static int SetUpDefaultRemoteAppVNet(Mock<IRemoteAppManagementClient> clientMock, string vNetName) { VNetListResult response = new VNetListResult(); response.VNetList = new List<VNet>() { new VNet() { Name = vNetName, Region = "West US", State = VNetState.Ready }, new VNet() { Name = "test2", Region = "East US", State = VNetState.Provisioning } }; mockVNetList = new List<VNet>(); foreach (VNet vNet in response.VNetList) { VNet mockVNet = new VNet() { Name = vNet.Name, Region = vNet.Region, State = vNet.State }; mockVNetList.Add(mockVNet); } ISetup<IRemoteAppManagementClient, Task<VNetListResult>> setup = clientMock.Setup(c => c.VNet.ListAsync(It.IsAny<CancellationToken>())); setup.Returns(Task.Factory.StartNew(() => response)); return mockVNetList.Count; }
public static bool ContainsExpectedVNet(List<VNet> expectedResult, VNet operationResult) { bool isIdentical = false; foreach (VNet expected in expectedResult) { isIdentical = expected.Name == operationResult.Name; isIdentical &= expected.Region == operationResult.Region; isIdentical &= expected.SharedKey == operationResult.SharedKey; isIdentical &= expected.State == operationResult.State; if (isIdentical) { break; } } return isIdentical; }