예제 #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>()));
        }
예제 #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);
        }