Пример #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.GetTwitterUserDetailsById(null));
        }
Пример #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.GetTwitterUserDetailsById("123");

            //Assert
            apiCallerMock.Verify(v => v.GetTwitterData(It.IsAny <string>()), Times.Once);
        }
Пример #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 <FolloweeFromApiDto>(It.IsAny <string>())).Returns(new FolloweeFromApiDto());

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

            //Assert
            Assert.IsInstanceOfType(result, typeof(FolloweeFromApiDto));
        }
Пример #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 <FolloweeFromApiDto>(It.IsAny <string>())).Returns(new FolloweeFromApiDto());

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

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