Exemplo n.º 1
0
        public void LoadCsmSubscriptions(List <Azure.Subscriptions.Csm.Models.Subscription> subscriptions)
        {
            var subscriptionOperationsMock = new Mock <Azure.Subscriptions.Csm.ISubscriptionOperations>();

            subscriptionOperationsMock.Setup(f => f.ListAsync(new CancellationToken()))
            .Returns(Task.Factory.StartNew(() => new Azure.Subscriptions.Csm.Models.SubscriptionListResult
            {
                Subscriptions = subscriptions
            }));

            CsmSubscriptionClientMock.Setup(f => f.Subscriptions).Returns(subscriptionOperationsMock.Object);
        }
Exemplo n.º 2
0
        public void LoadTenants(List <Azure.Subscriptions.Csm.Models.TenantIdDescription> tenantIds = null)
        {
            tenantIds = tenantIds ?? new[]
            {
                new Azure.Subscriptions.Csm.Models.TenantIdDescription
                {
                    Id       = "Common",
                    TenantId = "Common"
                }
            }.ToList();
            var tenantOperationsMock = new Mock <Azure.Subscriptions.Csm.ITenantOperations>();

            tenantOperationsMock.Setup(f => f.ListAsync(new CancellationToken()))
            .Returns(Task.Factory.StartNew(() => new Azure.Subscriptions.Csm.Models.TenantListResult
            {
                TenantIds = tenantIds
            }));

            CsmSubscriptionClientMock.Setup(f => f.Tenants).Returns(tenantOperationsMock.Object);
        }
Exemplo n.º 3
0
        public void LoadCsmSubscriptions(List <Azure.Subscriptions.Models.Subscription> subscriptions)
        {
            var subscriptionOperationsMock = new Mock <Azure.Subscriptions.ISubscriptionOperations>();

            subscriptionOperationsMock.Setup(f => f.ListAsync(new CancellationToken()))
            .Returns(Task.Factory.StartNew(() => new Azure.Subscriptions.Models.SubscriptionListResult
            {
                Subscriptions = subscriptions
            }));

            var tenantOperationsMock = new Mock <Azure.Subscriptions.ITenantOperations>();

            tenantOperationsMock.Setup(f => f.ListAsync(new CancellationToken()))
            .Returns(Task.Factory.StartNew(() => new Azure.Subscriptions.Models.TenantListResult
            {
                TenantIds = new[] { new Azure.Subscriptions.Models.TenantIdDescription
                                    {
                                        Id = "1", TenantId = "1"
                                    } }.ToList()
            }));

            CsmSubscriptionClientMock.Setup(f => f.Subscriptions).Returns(subscriptionOperationsMock.Object);
            CsmSubscriptionClientMock.Setup(f => f.Tenants).Returns(tenantOperationsMock.Object);
        }