public void GetByIdTest_Id_123_VerifyTaskNotNull()
        {
            var result = TestHelper.GetTestSingleTaskResult();
            _mockedRestClient.Setup(x => x.Execute<SingleTaskResult>(It.IsAny<IRestRequest>()).Data).Returns(result);
            var taskApiRepository = new TaskApiRepository(_mockedRestClient.Object);

            const int id = 123;

            var task = taskApiRepository.GetTaskById(id);

            task.ShouldNotBeNull();
        }
        public void GetByIdTest_Id_123_VerifyExecuteCalledOnce()
        {
            var result = TestHelper.GetTestSingleTaskResult();
            _mockedRestClient.Setup(x => x.Execute<SingleTaskResult>(It.IsAny<IRestRequest>()).Data).Returns(result);
            var taskApiRepository = new TaskApiRepository(_mockedRestClient.Object);

            const int id = 123;

            var task = taskApiRepository.GetTaskById(id);

            _mockedRestClient.Verify(x => x.Execute<SingleTaskResult>(It.IsAny<IRestRequest>()).Data, Times.Once());
        }
        public void GetByIdTest_Id_123_VerifyTaskNotNull()
        {
            SingleTaskResult result = GetTestSingleTaskResult();
            mockedRestClient.Setup(x => x.Execute<SingleTaskResult>(It.IsAny<IRestRequest>()).Data).Returns(result);
            var taskApiRepository = new TaskApiRepository(mockedRestClient.Object);

            int id = 123;

            Task task = taskApiRepository.GetTaskById(id);

            Assert.IsNotNull(task);
        }
        public void GetByIdTest_Id_123_VerifyExecuteCalledOnce()
        {
            var result = GetTestSingleTaskResult();

            _mockedRestClient.Setup(x => x.Execute <SingleTaskResult>(It.IsAny <IRestRequest>()).Data).Returns(result);
            var taskApiRepository = new TaskApiRepository(_mockedRestClient.Object);

            const int id = 123;

            var task = taskApiRepository.GetTaskById(id);

            _mockedRestClient.Verify(x => x.Execute <SingleTaskResult>(It.IsAny <IRestRequest>()).Data, Times.Once());
        }
        public void GetByIdTest_Id_123_Returns_Null_VerifyTaskIsNull()
        {
            SingleTaskResult result = null;

            _mockedRestClient.Setup(x => x.Execute <SingleTaskResult>(It.IsAny <IRestRequest>()).Data).Returns(result);
            var taskApiRepository = new TaskApiRepository(_mockedRestClient.Object);

            const int id = 123;

            var task = taskApiRepository.GetTaskById(id);

            Assert.IsNull(task);
        }
Esempio n. 6
0
        public void GetByIdTest_Id_123_VerifyTaskNotNull()
        {
            SingleTaskResult result = GetTestSingleTaskResult();

            mockedRestClient.Setup(x => x.Execute <SingleTaskResult>(It.IsAny <IRestRequest>()).Data).Returns(result);
            var taskApiRepository = new TaskApiRepository(mockedRestClient.Object);

            int id = 123;

            Task task = taskApiRepository.GetTaskById(id);

            Assert.IsNotNull(task);
        }
        public void GetByIdTest_Id_123_VerifyTaskNotNull()
        {
            var result = TestHelper.GetTestSingleTaskResult();

            _mockedRestClient.Setup(x => x.Execute <SingleTaskResult>(It.IsAny <IRestRequest>()).Data).Returns(result);
            var taskApiRepository = new TaskApiRepository(_mockedRestClient.Object);

            const int id = 123;

            var task = taskApiRepository.GetTaskById(id);

            task.ShouldNotBeNull();
        }