public void GetRisks_RaiseException_Returns_HttpError()
        {
            //Arrange
            var riskRepositoryMock = new Mock <IRiskRepository>();

            riskRepositoryMock.Setup(x => x.GetRisks(It.IsAny <string>(), It.IsAny <Sortorder>(), It.IsAny <int>(), It.IsAny <int>())).Throws <Exception>();
            var risksController = new RisksController(riskRepositoryMock.Object)
            {
                Request       = new HttpRequestMessage(),
                Configuration = new HttpConfiguration
                {
                    IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.LocalOnly
                }
            };
            //Act
            var response = risksController.Get();
        }
        public void GetRisks_When_NoData_Returns_NoContent()
        {
            //Arrange
            var riskRepositoryMock = new Mock <IRiskRepository>();

            riskRepositoryMock.Setup(x => x.GetRisks(It.IsAny <string>(), It.IsAny <Sortorder>(), It.IsAny <int>(), It.IsAny <int>())).Returns(_nilRisks);
            var risksController = new RisksController(riskRepositoryMock.Object)
            {
                Request       = new HttpRequestMessage(),
                Configuration = new HttpConfiguration
                {
                    IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.LocalOnly
                }
            };
            //Act
            var response = risksController.Get();

            //Assert
            Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
        }
        public void GetRisks_WithoutPagination_Returns_Success()
        {
            //Arrange
            var riskRepositoryMock = new Mock <IRiskRepository>();

            riskRepositoryMock.Setup(x => x.GetRisks(It.IsAny <string>(), It.IsAny <Sortorder>(), It.IsAny <int>(), It.IsAny <int>())).Returns(_validRiskResponse);
            var risksController = new RisksController(riskRepositoryMock.Object)
            {
                Request       = new HttpRequestMessage(),
                Configuration = new HttpConfiguration
                {
                    IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.LocalOnly
                }
            };
            //Act
            var response = risksController.Get();
            var risks    = response.Content.ReadAsAsync(typeof(List <Risk>)).Result;

            //Assert
            Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
        }