public void ConnectControlSingleton_Refresh_SelectedServerIsConnected_StudioRepositoryLoadIsCalled()
        {
            var serverProvider        = new Mock <IEnvironmentModelProvider>();
            var environmentRepository = new Mock <IServerRepository>();
            var environmentModels     = new List <IServer>
            {
                new TestServer(new Mock <IEventAggregator>().Object, Guid.NewGuid(), CommonSetupHelper.CreateConnection(false).Object, new Mock <IResourceRepository>().Object, false)
            };

            serverProvider.Setup(s => s.Load()).Returns(environmentModels);
            IConnectControlSingleton connectControlSingleton = new ConnectControlSingleton(serverProvider.Object, environmentRepository.Object);
            var selectedServer = connectControlSingleton.Servers[1];

            selectedServer.IsConnected = true;

            var actualConnectedState = ConnectionEnumerations.ConnectedState.Connected;
            var actualDoCallback     = false;
            var environmentId        = Guid.Empty;
            var selectedId           = selectedServer.Server.EnvironmentID;

            connectControlSingleton.ConnectedStatusChanged += (sender, arg) =>
            {
                actualConnectedState = arg.ConnectedStatus;
                actualDoCallback     = arg.DoCallback;
                environmentId        = arg.EnvironmentId;
            };
            //------------Execute Test---------------------------
            connectControlSingleton.Refresh(selectedId);
            //------------Assert Results-------------------------
            Assert.IsNotNull(connectControlSingleton);
            Assert.AreEqual(ConnectionEnumerations.ConnectedState.Busy, actualConnectedState);
            Assert.IsFalse(actualDoCallback);
            Assert.AreEqual(selectedId, environmentId);
        }
Esempio n. 2
0
 public void RefreshConnectControl()
 {
     ConnectControlSingleton.Refresh(_environment.ID);
 }