コード例 #1
0
        public void ServerServiceConfiguration_PromptUserToStartService_WhenNullServiceConfiguration_ExpectException()
        {
            //------------Setup for test--------------------------
            var serverServiceConfiguration = new ServerServiceConfiguration(null);

            //------------Execute Test---------------------------
            serverServiceConfiguration.PromptUserToStartService();

        }
コード例 #2
0
        static ServerServiceConfiguration CreateServerServiceConfiguration(bool isServiceRunning, bool startServiceResult)
        {
            Mock<IWindowsServiceManager> serviceManager = new Mock<IWindowsServiceManager>();
            serviceManager.Setup(sm => sm.IsRunning()).Returns(isServiceRunning);
            serviceManager.Setup(sm => sm.Start()).Returns(startServiceResult);
            serviceManager.Setup(sm => sm.Exists()).Returns(true);

            var serverServiceConfiguration = new ServerServiceConfiguration(serviceManager.Object);
            return serverServiceConfiguration;
        }
コード例 #3
0
        static ServerServiceConfiguration CreateServerServiceConfiguration(bool isServiceRunning, MessageBoxResult promptResult, out Mock<IPopupController> ctrl)
        {
            Mock<IWindowsServiceManager> serviceManager = new Mock<IWindowsServiceManager>();
            serviceManager.Setup(sm => sm.IsRunning()).Returns(isServiceRunning);

            Mock<IPopupController> controller = new Mock<IPopupController>();
            controller.Setup(c => c.Show(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<MessageBoxButton>(), It.IsAny<MessageBoxImage>(), It.IsAny<string>())).Verifiable();
            controller.Setup(c => c.Show(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<MessageBoxButton>(), It.IsAny<MessageBoxImage>(), It.IsAny<string>())).Returns(promptResult);

            ctrl = controller;

            var serverServiceConfiguration = new ServerServiceConfiguration(serviceManager.Object, controller.Object);

            return serverServiceConfiguration;

        }
コード例 #4
0
        static ServerServiceConfiguration CreateServerServiceConfiguration(bool isServiceRunning)
        {
            Mock<IWindowsServiceManager> serviceManager = new Mock<IWindowsServiceManager>();
            serviceManager.Setup(sm => sm.IsRunning()).Returns(isServiceRunning);

            var serverServiceConfiguration = new ServerServiceConfiguration(serviceManager.Object);
            return serverServiceConfiguration;
        }