Ejemplo n.º 1
0
        public void GetRestResponseException_GivenIRestResponseIsSuccessful_ShouldReturnNullException()
        {
            // Arrange
            var mock = new Mock <IRestResponse>();

            mock.Setup(x => x.IsSuccessful).Returns(true);
            IRestResponse restRespone = mock.Object;

            // Act
            var result = restRespone.GetFailedRestResponseException();

            // Assert
            Assert.Null(result);
        }
Ejemplo n.º 2
0
        public void GetRestResponseException_GivenIRestResponseIsNotSuccessful_ShouldReturnException()
        {
            // Arrange
            var defaultMessage = "not specified";
            var mock           = new Mock <IRestResponse>();

            mock.Setup(x => x.IsSuccessful).Returns(false);

            IRestResponse restRespone = mock.Object;

            // Act
            var result = restRespone.GetFailedRestResponseException();

            // Assert
            Assert.NotNull(result);
        }
Ejemplo n.º 3
0
        public void GetRestResponseException_GivenNullIRestResponse_ShouldThrowArgumentNullException()
        {
            IRestResponse restRespone = null;

            Assert.Throws <ArgumentNullException>(() => restRespone.GetFailedRestResponseException());
        }