public void EnableAzureMemcacheRoleProcess() { using (FileSystemHelper files = new FileSystemHelper(this)) { string serviceName = "AzureService"; string rootPath = files.CreateNewService(serviceName); string cacheRoleName = "WorkerRole"; string webRoleName = "WebRole"; string expectedMessage = string.Format(Resources.EnableMemcacheMessage, webRoleName, cacheRoleName, Resources.MemcacheEndpointPort); addNodeWebCmdlet = new AddAzureNodeWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = webRoleName }; addNodeWebCmdlet.ExecuteCmdlet(); addCacheRoleCmdlet.AddAzureCacheWorkerRoleProcess(cacheRoleName, 1, rootPath); mockCommandRuntime.ResetPipelines(); enableCacheCmdlet.PassThru = true; enableCacheCmdlet.CacheRuntimeVersion = "1.8.0"; enableCacheCmdlet.EnableAzureMemcacheRoleProcess(webRoleName, cacheRoleName, rootPath); AssertCachingEnabled(files, serviceName, rootPath, webRoleName, expectedMessage); } }
public void EnableAzureMemcacheRoleProcessAlreadyEnabledFail() { using (FileSystemHelper files = new FileSystemHelper(this)) { string serviceName = "AzureService"; string rootPath = files.CreateNewService(serviceName); string cacheRoleName = "WorkerRole"; string webRoleName = "WebRole"; string expected = string.Format(Resources.CacheAlreadyEnabledMessage, webRoleName); addNodeWebCmdlet = new AddAzureNodeWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = webRoleName }; addNodeWebCmdlet.ExecuteCmdlet(); addCacheRoleCmdlet.AddAzureCacheWorkerRoleProcess(cacheRoleName, 1, rootPath); enableCacheCmdlet.EnableAzureMemcacheRoleProcess(webRoleName, cacheRoleName, rootPath); Testing.AssertThrows<Exception>(() => enableCacheCmdlet.EnableAzureMemcacheRoleProcess(webRoleName, cacheRoleName, rootPath)); } }
public void EnableAzureMemcacheWithNoCacheWorkerRolesFail() { using (FileSystemHelper files = new FileSystemHelper(this)) { string serviceName = "AzureService"; string rootPath = files.CreateNewService(serviceName); string webRoleName = "WebRole"; string expectedMessage = string.Format(Resources.NoCacheWorkerRoles); addNodeWebCmdlet = new AddAzureNodeWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = webRoleName }; addNodeWebCmdlet.ExecuteCmdlet(); addNodeWorkerCmdlet = new AddAzureNodeWorkerRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = "WorkerRole" }; addNodeWorkerCmdlet.ExecuteCmdlet(); mockCommandRuntime.ResetPipelines(); enableCacheCmdlet.PassThru = true; enableCacheCmdlet.CacheRuntimeVersion = "1.8.0"; Testing.AssertThrows<Exception>(() => enableCacheCmdlet.EnableAzureMemcacheRoleProcess(webRoleName, null, rootPath), expectedMessage); } }