public void Setup() { var factory = new AzureStorageFactory(CloudStorageAccount.DevelopmentStorageAccount); _repository = new WebSiteRepository(factory); _webSiteTable = factory.GetTable<WebSiteRow>(typeof(WebSiteRow).Name); _bindingTable = factory.GetTable<BindingRow>(typeof(BindingRow).Name); }
protected override void FixtureSetup() { base.FixtureSetup(); // RoleEnvironment AzureRoleEnvironment.DeploymentId = () => "DEPLOYMENTID"; AzureRoleEnvironment.CurrentRoleInstanceId = () => "ROLEINSTANCEID"; // File Resource Paths var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", "")); _sitePath = Path.Combine(basePath, "Sites"); _tempPath = Path.Combine(basePath, "Temp"); _configPath = Path.Combine(basePath, "Config"); _resourcesPath = Path.Combine(basePath, "_resources"); Directory.CreateDirectory(_sitePath); Directory.CreateDirectory(_tempPath); Directory.CreateDirectory(_configPath); // Website Repository var factory = new AzureStorageFactory(CloudStorageAccount.DevelopmentStorageAccount); _repo = new WebSiteRepository(factory); _webSiteTable = factory.GetTable<WebSiteRow>(typeof(WebSiteRow).Name); _bindingTable = factory.GetTable<BindingRow>(typeof(BindingRow).Name); // Clean up IIS and table storage to prepare for test using (var serverManager = new ServerManager()) { _excludedSites = new List<string>(); using (var manager = new ServerManager()) { manager.Sites.Where(s => s.Name != AzureRoleEnvironment.RoleWebsiteName()).ToList().ForEach(s => _excludedSites.Add(s.Name)); } CleanupWebsiteTest(serverManager); } // Sync Service _syncService = new SyncService( _repo, new SyncStatusRepository(factory), CloudStorageAccount.DevelopmentStorageAccount, _sitePath, _tempPath, new string[] { }, _excludedSites, () => true, new IISManager(_sitePath, _tempPath, new SyncStatusRepository(factory), new ConsoleFactory(), LoggerLevel.Debug), new ConsoleFactory(), LoggerLevel.Debug ); }