예제 #1
0
        public void DeployViewConnectedToVisiblityConverter_Convert_EnvironmentModelIsNull_VisibilityIsCollapsed()
        {
            //Arrange
            var converter = new DeployViewConnectedToVisiblityConverter();
            //Act
            var actual = (Visibility)converter.Convert(null, typeof(bool), null, null);

            //Assert
            Assert.AreEqual(Visibility.Collapsed, actual);
        }
예제 #2
0
        public void DeployViewConnectedToVisiblityConverter_Convert_IsConnectedIsTrue_VisibilityIsCollapsed()
        {
            //Arrange
            var converter = new DeployViewConnectedToVisiblityConverter();
            Mock <IEnvironmentConnection> mockEnvironmentConnection = new Mock <IEnvironmentConnection>();

            mockEnvironmentConnection.Setup(m => m.ServerEvents).Returns(new Mock <IEventPublisher>().Object);
            mockEnvironmentConnection.Setup(m => m.IsConnected).Returns(true);
            IEnvironmentModel environmentModel = new EnvironmentModel(Guid.NewGuid(), mockEnvironmentConnection.Object, new Mock <IStudioResourceRepository>().Object);

            //Act
            var actual = (Visibility)converter.Convert(environmentModel, typeof(bool), null, null);

            //Assert
            Assert.AreEqual(Visibility.Visible, actual);
        }
        public void DeployViewConnectedToVisiblityConverter_Convert_IsConnectedIsFalse_VisibilityIsCollapsed()
        {
            //Arrange
            var converter = new DeployViewConnectedToVisiblityConverter();
            var mockEnvironmentConnection = new Mock <IEnvironmentConnection>();

            mockEnvironmentConnection.Setup(m => m.ServerEvents).Returns(new Mock <IEventPublisher>().Object);
            mockEnvironmentConnection.Setup(m => m.IsConnected).Returns(false);
            IServer server = new Server(Guid.NewGuid(), mockEnvironmentConnection.Object);

            //Act
            var actual = (Visibility)converter.Convert(server, typeof(bool), null, null);

            //Assert
            Assert.AreEqual(Visibility.Collapsed, actual);
        }