Exemple #1
0
 private void SetupFirewallResponse(FirewallRuleResponse response)
 {
     ResourceManagerMock.Setup(r => r.CreateFirewallRuleAsync(
                                   It.IsAny <IAzureResourceManagementSession>(),
                                   It.IsAny <IAzureSqlServerResource>(),
                                   It.IsAny <FirewallRuleRequest>())
                               ).Returns(() => Task.FromResult(response));
 }
Exemple #2
0
 private void SetupCreateSession()
 {
     ResourceManagerMock.Setup(r => r.CreateSessionAsync(It.IsAny <IAzureUserAccountSubscriptionContext>()))
     .Returns((IAzureUserAccountSubscriptionContext sub) =>
     {
         var sessionMock = new Mock <IAzureResourceManagementSession>();
         sessionMock.SetupProperty(s => s.SubscriptionContext, sub);
         return(Task.FromResult(sessionMock.Object));
     });
 }
Exemple #3
0
        private void SetupAzureServers(IAzureSubscriptionContext sub, IEnumerable <IAzureSqlServerResource> servers)
        {
            Func <IAzureResourceManagementSession, bool> isExpectedSub = (session) =>
            {
                return(session.SubscriptionContext == sub);
            };

            ResourceManagerMock.Setup(r => r.GetSqlServerAzureResourcesAsync(
                                          It.Is <IAzureResourceManagementSession>((session) => isExpectedSub(session))
                                          )).Returns(() => Task.FromResult(servers));
        }