Inheritance: Dev2.Services.Security.SecurityServiceBase
        public void ClientSecurityService_Constructor_EnvironmentConnectionIsNull_ThrowsArgumentNullException()
        {
            //------------Setup for test--------------------------

            //------------Execute Test---------------------------
            var clientSecurityService = new ClientSecurityService(null);

            //------------Assert Results-------------------------
        }
        public void ClientSecurityService_OnDispose_DoesNothing()
        {
            //------------Setup for test--------------------------
            var connection = new Mock<IEnvironmentConnection>();
            connection.Setup(c => c.ServerEvents).Returns(new Mock<IEventPublisher>().Object);
            var clientSecurityService = new ClientSecurityService(connection.Object);

            //------------Execute Test---------------------------
            clientSecurityService.Dispose();

            //------------Assert Results-------------------------
            Assert.IsTrue(true);
        }
        void Verify_EnvironmentConnection_NetworkStateChanged(NetworkState fromState, NetworkState toState)
        {
            //------------Setup for test--------------------------
            var workspaceID = Guid.NewGuid();
            var dataListID = Guid.Empty;

            var serializer = new Dev2JsonSerializer();
            var requestResult = serializer.SerializeToBuilder(new SecuritySettingsTO());

            StringBuilder actualRequest = null;

            var connection = new Mock<IEnvironmentConnection>();
            connection.Setup(c => c.ServerEvents).Returns(new Mock<IEventPublisher>().Object);
            connection.Setup(c => c.WorkspaceID).Returns(workspaceID);
            connection.Setup(c => c.IsConnected).Returns(true);
            connection.Setup(c => c.ExecuteCommand(It.IsAny<StringBuilder>(), workspaceID, dataListID))
                .Callback((StringBuilder xmlRequest, Guid wsID, Guid dlID) => { actualRequest = xmlRequest; })
                .Returns(requestResult)
                .Verifiable();

            var clientSecurityService = new ClientSecurityService(connection.Object);

            //------------Execute Test---------------------------
            connection.Raise(c => c.NetworkStateChanged += null, new NetworkStateEventArgs(fromState, toState));

            // wait for ReadAsync to finish
            Thread.Sleep(1000);

            //------------Assert Results-------------------------
            if(toState == NetworkState.Online)
            {
                connection.Verify(c => c.ExecuteCommand(It.IsAny<StringBuilder>(), workspaceID, dataListID), Times.Never());
                Assert.IsNull(actualRequest);
            }
            else
            {
                connection.Verify(c => c.ExecuteCommand(It.IsAny<StringBuilder>(), workspaceID, dataListID), Times.Never());
                Assert.IsNull(actualRequest);
            }
        }
        public void ClientSecurityService_ReadAsync_DoesInvokeReadPermissions()
        {
            //------------Setup for test--------------------------
            var workspaceID = Guid.NewGuid();
            var dataListID = Guid.Empty;

            var serializer = new Dev2JsonSerializer();
            var requestResult = serializer.SerializeToBuilder(new SecuritySettingsTO());

            StringBuilder actualRequest = null;

            var connection = new Mock<IEnvironmentConnection>();
            connection.Setup(c => c.ServerEvents).Returns(new Mock<IEventPublisher>().Object);
            connection.Setup(c => c.WorkspaceID).Returns(workspaceID);
            connection.Setup(c => c.IsConnected).Returns(true);
            connection.Setup(c => c.ExecuteCommand(It.IsAny<StringBuilder>(), workspaceID, dataListID))
                .Callback((StringBuilder xmlRequest, Guid wsID, Guid dlID) => { actualRequest = xmlRequest; })
                .Returns(requestResult)
                .Verifiable();

            var clientSecurityService = new ClientSecurityService(connection.Object);

            //------------Execute Test---------------------------
            var readTask = clientSecurityService.ReadAsync();
            readTask.Wait();

            //------------Assert Results-------------------------
            connection.Verify(c => c.ExecuteCommand(It.IsAny<StringBuilder>(), workspaceID, dataListID),Times.Never());
            Assert.IsNull(actualRequest);
        }