Beispiel #1
0
        public void Throw_ArgumentNullException_When_Input_Is_Null()
        {
            //Arrange
            var apiCallerMock         = Mock.Of <ITwitterApiCaller>();
            var jsonDerserializerMock = Mock.Of <IJsonDeserializer>();
            var sut = new TwitterApiCallService(apiCallerMock, jsonDerserializerMock);

            //Act && Assert
            Assert.ThrowsException <ArgumentNullException>(() => sut.GetTweetByTweetId(null));
        }
Beispiel #2
0
        public void Invoke_GetTwitterData_From_ApiCaller_When_Input_Is_Valid()
        {
            //Arrange
            var apiCallerMock         = new Mock <ITwitterApiCaller>();
            var jsonDerserializerMock = Mock.Of <IJsonDeserializer>();
            var sut = new TwitterApiCallService(apiCallerMock.Object, jsonDerserializerMock);

            //Act
            var result = sut.GetTweetByTweetId("123");

            //Assert
            apiCallerMock.Verify(v => v.GetTwitterData(It.IsAny <string>()), Times.Once);
        }
Beispiel #3
0
        public void Return_Instance_Of_TypeFolloweeFromApiDtoArray_When_Input_Is_Valid()
        {
            //Arrange
            var apiCallerMock         = new Mock <ITwitterApiCaller>();
            var jsonDerserializerMock = new Mock <IJsonDeserializer>();
            var sut = new TwitterApiCallService(apiCallerMock.Object, jsonDerserializerMock.Object);

            jsonDerserializerMock.Setup(s => s.Deserialize <TweetFromApiDto>(It.IsAny <string>())).Returns(new TweetFromApiDto());

            //Act
            var result = sut.GetTweetByTweetId("123");

            //Assert
            Assert.IsInstanceOfType(result, typeof(TweetFromApiDto));
        }
Beispiel #4
0
        public void Invoke_Deserialize_From_jsonDeserializer_When_Input_Is_Valid()
        {
            //Arrange
            var apiCallerMock         = new Mock <ITwitterApiCaller>();
            var jsonDerserializerMock = new Mock <IJsonDeserializer>();
            var sut = new TwitterApiCallService(apiCallerMock.Object, jsonDerserializerMock.Object);

            jsonDerserializerMock.Setup(s => s.Deserialize <TweetFromApiDto>(It.IsAny <string>())).Returns(new TweetFromApiDto());

            //Act
            var result = sut.GetTweetByTweetId("123");

            //Assert
            jsonDerserializerMock.Verify(v => v.Deserialize <TweetFromApiDto>(It.IsAny <string>()), Times.Once);
        }