Exemplo n.º 1
0
        public void SendEmptyState()
        {
            var expectedState   = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 };
            var client          = new OrchestratorClient(IPAddress.Loopback);
            var sendStateResult = client.CommitChanges();

            bool statesMatching = sendStateResult.State.SequenceEqual(expectedState);

            Assert.IsTrue(statesMatching);
        }
Exemplo n.º 2
0
        public void SendCorrectState_WithSingleOutput()
        {
            var expectedState = new byte[] { 1, 0, 0, 0, 0, 0, 0, 0 };
            var client        = new OrchestratorClient(IPAddress.Loopback);

            client.SetOutput(0, true);
            var sendStateResult = client.CommitChanges();

            bool statesMatching = sendStateResult.State.SequenceEqual(expectedState);

            Assert.IsTrue(statesMatching);
        }
Exemplo n.º 3
0
        public void CommitChanges()
        {
            var result = _client?.CommitChanges();

            if (result == null)
            {
                return;
            }

            if (!result.StateChanged)
            {
                return;
            }

            _logService.Information("Sent " + BitConverter.ToString(result.State));

            ChangesCommitted?.Invoke(this, new ChangesCommittedEventArgs(result.State));
        }