Esempio n. 1
0
        public void RemovedHandler_HandleMessage_DeserializeAndCallsCollectionManager()
        {
            var connectionMock = new Mock<IDdpConnectionSender>();
            var collectionMock = new Mock<ICollectionManager>();
            var resultHandlerMock = new Mock<IResultHandler>();

            var testObject = new SimpleDdpObject { IsTrue = false };
            var added = new Removed() {Collection = "Test", Id = "ID"};

            var handler = new RemovedHandler();

            handler.HandleMessage(connectionMock.Object, collectionMock.Object, resultHandlerMock.Object,
                JsonConvert.SerializeObject(added));

            collectionMock.Verify(collection => collection.Removed(It.IsAny<Removed>()), Times.Once());
        }
Esempio n. 2
0
        public void RemovedHandler_CanHandle_InvalidMessageType()
        {
            var handler = new RemovedHandler();

            Assert.IsFalse(handler.CanHandle("invalid"));
        }
Esempio n. 3
0
        public void RemovedHandler_CanHandle_ValidMessageType()
        {
            var handler = new RemovedHandler();

            Assert.IsTrue(handler.CanHandle("removed"));
        }