Exemplo n.º 1
0
        public void Auth_AnyInput_CallsPusherProvider()
        {
            //Arrange
            _pusherProviderMock.Setup(m => m.Authenticate(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<PresenceChannelData>()));

            var pusherService = new PusherService(_pusherMock.Object, _pusherProviderMock.Object);

            //Act
            pusherService.Auth(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<object>());

            //Assert
            _pusherProviderMock.Verify(m => m.Authenticate(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<PresenceChannelData>()));
        }
Exemplo n.º 2
0
        public void Auth_ValidInput_ReturnsString()
        {
            //Arrange
            const string channelName = "anychannel";
            const string socket = "anySocket";
            var channelData = new PresenceChannelData() { user_id = Guid.NewGuid().ToString() };
            const string expectedResult = "expectedResult";

            _pusherProviderMock.Setup(m => m.Authenticate(channelName, socket, channelData))
                .Returns(expectedResult);

            var pusherService = new PusherService(_pusherMock.Object, _pusherProviderMock.Object);

            //Act
            var result = pusherService.Auth(channelName, socket, "", new object());

            //Assert
            Assert.AreEqual(expectedResult, result);
        }
Exemplo n.º 3
0
        public void UpdateStock_UnvailableProduct_CallsPusher()
        {
            //Arrange
            _pusherMock.Setup(m => m.Trigger(It.IsAny<string>(), It.IsAny<string>(), _unavailableProduct));

            var pusherService = new PusherService(_pusherMock.Object, _pusherProviderMock.Object);

            //Act
            pusherService.UpdateStock(_unavailableProduct);

            //Assert
            _pusherMock.Verify(m => m.Trigger(It.IsAny<string>(), It.IsAny<string>(), _unavailableProduct), Times.Never);
        }