public void Start_StorageEmulatorNotInstalled_GetWarning()
        {
            // Setup 
            StorageEmulator emulator = new StorageEmulator(null);
            Mock<ProcessHelper> commandRunner = new Mock<ProcessHelper>();

            // Execute
            emulator.Start();

            // Assert
            Assert.Equal(Resources.WarningWhenStorageEmulatorIsMissing, emulator.Error);
        }
        public void Stop_StorageEmulatorInstalled_UseCorrectCommand()
        {
            // Setup 
            string testFolder = @"c:\sample-path";
            string expectedCommand = Path.Combine(testFolder, Resources.StorageEmulatorExe);

            StorageEmulator emulator = new StorageEmulator(@"c:\sample-path");
            Mock<ProcessHelper> commandRunner = new Mock<ProcessHelper>();
            commandRunner.Setup(p => p.StartAndWaitForProcess(expectedCommand, Resources.StopStorageEmulatorCommandArgument));
            emulator.CommandRunner = commandRunner.Object;

            // Execute
            emulator.Stop();

            // Assert
            commandRunner.Verify();
        }
        public void StopEmulators(out string warning)
        {
            var runTool = new CsRun(AzureTool.GetComputeEmulatorDirectory());
            runTool.StopComputeEmulator();

            var storageEmulator = new StorageEmulator(AzureTool.GetStorageEmulatorDirectory());
            storageEmulator.Stop();
            //for now, errors related with storage emulator are treated as non-fatal
            warning = storageEmulator.Error;
        }
        /// <summary>
        /// Starts azure emulator for this service.
        /// </summary>
        /// <remarks>This methods removes all deployments already in the emulator.</remarks>
        /// <param name="launchBrowser">Switch to control opening a browser for web roles.</param>
        /// <param name="mode"></param>
        /// <param name="roleInformation"></param>
        /// <param name="warning"></param>
        public void StartEmulators(bool launchBrowser, ComputeEmulatorMode mode , out string roleInformation, out string warning)
        {
            var runTool = new CsRun(AzureTool.GetComputeEmulatorDirectory());
            runTool.StartEmulator(Paths.LocalPackage, Paths.LocalConfiguration, launchBrowser, mode);

            roleInformation = runTool.RoleInformation;

            var storageEmulator = new StorageEmulator(AzureTool.GetStorageEmulatorDirectory());
            storageEmulator.Start();

            //for now, errors related with storage emulator are treated as non-fatal
            warning = storageEmulator.Error;
        }