Beispiel #1
0
        public void GettingPersonsByInsolvencyOrderId_WhenThereAreNoneToReturn_ReturnsOkStatusCode200()
        {
            // Arrange
            const int insolvencyOrderId  = 7654321;
            const int expectedStatusCode = 200;

            var collectionResourceInfo = new CollectionResourceInfo(0, 10, 1);
            var collectionResource     =
                new CollectionResource <InsolvencyOrderPersonModel>(collectionResourceInfo, new List <InsolvencyOrderPersonModel>());

            mockDataAccessCradle
            .Setup(cradle =>
                   cradle.GetPagedDataSetAsync(
                       It.IsAny <Func <Task <IEnumerable <InsolvencyOrderPersonModel> > > >(),
                       It.IsAny <Func <Task <int> > >()))
            .Returns(Task.FromResult(collectionResource));

            var controller =
                new InsolvencyOrderPersonsController(
                    mockDataAccessCradle.Object,
                    mockPersonsRepository.Object,
                    mockIncludeReader.Object,
                    mockPageInformationProvider.Object,
                    mockHalFormatter.Object,
                    mockHalCollectionFormatter.Object,
                    mockTelemetryClient.Object);

            // Act
            var result = controller.GetPersonsByInsolvencyIdAsync(insolvencyOrderId).GetAwaiter().GetResult();

            // Assert
            Assert.IsInstanceOfType(result, typeof(OkObjectResult));
            Assert.AreEqual(expectedStatusCode, ((OkObjectResult)result).StatusCode);
        }
Beispiel #2
0
        public void GetAllInsolvencyRecords_WhereThereAreSome_ReturnsOkStatusCode200()
        {
            // Arrange
            const int expectedStatusCode = 200;

            var collectionResourceInfo = new CollectionResourceInfo(0, 10, 1);
            var collectionResource     =
                new CollectionResource <InsolvencyOrderModel>(collectionResourceInfo, TestFixture.CreateMany <InsolvencyOrderModel>(10).ToList());

            mockDataAccessCradle
            .Setup(cradle =>
                   cradle.GetPagedDataSetAsync(
                       It.IsAny <Func <Task <IEnumerable <InsolvencyOrderModel> > > >(),
                       It.IsAny <Func <Task <int> > >()))
            .Returns(Task.FromResult(collectionResource));

            var controller =
                new InsolvencyOrdersController(
                    mockDataAccessCradle.Object,
                    mockInsolvencyOrdersRepository.Object,
                    mockInsolvencyOrdersFlattenedRepository.Object,
                    mockIncludeReader.Object,
                    mockPageInformationReader.Object,
                    mockInsolvenciesHalFormatter.Object,
                    mockInsolvenciesHalCollectionFormatter.Object,
                    mockTelemetryClient.Object);

            // Act
            var result = controller.GetAllInsolvencyOrders().GetAwaiter().GetResult();

            // Assert
            Assert.IsInstanceOfType(result, typeof(OkObjectResult));
            Assert.AreEqual(expectedStatusCode, ((OkObjectResult)result).StatusCode);
        }
        public void GettingDisputesByInsolvencyId_WhenThereAreSome_ReturnsOkStatusCode200()
        {
            // Arrange
            const int insolvencyOrderId  = 1234567;
            const int expectedStatusCode = 200;

            var collectionResourceInfo = new CollectionResourceInfo(0, 10, 1);
            var collectionResource     =
                new CollectionResource <DisputeModel>(
                    collectionResourceInfo,
                    TestFixture.CreateMany <DisputeModel>(10).ToList());

            mockDataAccessCradle
            .Setup(dataAccessCradle =>
                   dataAccessCradle.GetPagedDataSetAsync(
                       It.IsAny <Func <Task <IEnumerable <DisputeModel> > > >(),
                       It.IsAny <Func <Task <int> > >()))
            .Returns(Task.FromResult(collectionResource));

            var controller =
                new DisputesController(
                    mockDataAccessCradle.Object,
                    mockDisputeRepository.Object,
                    mockIncludeReader.Object,
                    mockPageInformationProvider.Object,
                    mockDisputeFormatter.Object,
                    mockDisputeCollectionFormatter.Object,
                    mockTelemetryClient.Object);

            // Act
            var result = controller.GetDisputesByInsolvencyIdAsync(insolvencyOrderId).GetAwaiter().GetResult();

            // Assert
            Assert.IsInstanceOfType(result, typeof(OkObjectResult));
            Assert.AreEqual(expectedStatusCode, ((OkObjectResult)result).StatusCode);
        }