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

            var testObject = new SimpleDdpObject {IsTrue = false};
            var added = new Added {Collection = "Tests", Fields = JObject.FromObject(testObject),Id = "1"};

            var handler = new AddedHandler();

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

            collectionMock.Verify(collection => collection.Added(It.IsAny<Added>()), Times.Once());
        }
Ejemplo n.º 2
0
        public void AddedHandler_CanHandle_InvalidMessageType()
        {
            var handler = new AddedHandler();

            Assert.IsFalse(handler.CanHandle("invalid"));
        }
Ejemplo n.º 3
0
        public void AddedHandler_CanHandle_ValidMessageType()
        {
            var handler = new AddedHandler();

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