private void SetupFirewallResponse(FirewallRuleResponse response) { ResourceManagerMock.Setup(r => r.CreateFirewallRuleAsync( It.IsAny <IAzureResourceManagementSession>(), It.IsAny <IAzureSqlServerResource>(), It.IsAny <FirewallRuleRequest>()) ).Returns(() => Task.FromResult(response)); }
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)); }); }
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)); }