Beispiel #1
0
        public void Add_Where_ItemsExists_Expect_False()
        {
            ExecutionStatusCallbackDispatcher _executionStatusCallbackDispatcher = new ExecutionStatusCallbackDispatcher();

            Guid guid = Guid.NewGuid();
            Action <ExecutionStatusCallbackMessage> callback = new Action <ExecutionStatusCallbackMessage>(m => { });

            _executionStatusCallbackDispatcher.Add(guid, callback);

            bool expected = false;
            bool actual   = _executionStatusCallbackDispatcher.Add(guid, callback);

            Assert.AreEqual(expected, actual);
        }
        public void Add_Where_CallbackIsNull_Expect_ArgumentNullException()
        {
            ExecutionStatusCallbackDispatcher _executionStatusCallbackDispatcher = new ExecutionStatusCallbackDispatcher();

            Guid guid = Guid.NewGuid();

            _executionStatusCallbackDispatcher.Add(guid, null);
        }
Beispiel #3
0
        public void Add_Where_CallbackIsNull_Expect_ArgumentNullException()
        {
            ExecutionStatusCallbackDispatcher _executionStatusCallbackDispatcher = new ExecutionStatusCallbackDispatcher();

            Guid guid = Guid.NewGuid();
            Action <ExecutionStatusCallbackMessage> callback = null;

            _executionStatusCallbackDispatcher.Add(guid, callback);
        }
Beispiel #4
0
        public void Add_Where_ItemsDoesntExist_Expect_True()
        {
            ExecutionStatusCallbackDispatcher _executionStatusCallbackDispatcher = new ExecutionStatusCallbackDispatcher();

            Guid guid = Guid.NewGuid();
            Action <ExecutionStatusCallbackMessage> callback = m => { };

            bool expected = true;
            bool actual   = _executionStatusCallbackDispatcher.Add(guid, callback);

            Assert.AreEqual(expected, actual);
        }
Beispiel #5
0
        public void Send_Where_MessageDoesntHaveCallbackRegistered_Expect_CallbackNotInvoked()
        {
            ExecutionStatusCallbackDispatcher _executionStatusCallbackDispatcher = new ExecutionStatusCallbackDispatcher();

            bool expected = false;
            bool actual   = false;

            Guid guid = Guid.NewGuid();
            Action <ExecutionStatusCallbackMessage> callback = new Action <ExecutionStatusCallbackMessage>(m => { actual = true; });
            ExecutionStatusCallbackMessage          message  = new ExecutionStatusCallbackMessage(Guid.NewGuid(), ExecutionStatusCallbackMessageType.Unknown);

            _executionStatusCallbackDispatcher.Add(guid, callback);
            _executionStatusCallbackDispatcher.Send(message);

            Assert.AreEqual(expected, actual);
        }