Exemple #1
0
        public async Task Delete_sales_area_pass_priority_without_dependency()
        {
            _ = FakeLibrarySalesAreaPassPrioritiesRepository.Setup(m => m.GetAsync(FakeSalesAreaPassPriority.Uid)).ReturnsAsync(FakeSalesAreaPassPriority);
            _ = FakeTenantSettingsRepository.Setup(x => x.GetDefaultSalesAreaPassPriorityId()).Returns(Guid.NewGuid());

            using (var controller = new LibrarySalesAreaPassPrioritiesController(
                       FakeLibrarySalesAreaPassPrioritiesRepository.Object,
                       FakeTenantSettingsRepository.Object,
                       Mapper, null, null
                       ))
            {
                // Act
                IHttpActionResult actionResult = await controller.Delete(FakeSalesAreaPassPriority.Uid);

                var response = actionResult as StatusCodeResult;

                // Assert
                Assert.That(response.StatusCode == HttpStatusCode.NoContent);
            }
        }
Exemple #2
0
        public async Task Delete_sales_area_pass_priority_with_valid_guid_which_not_exists_status_code_200_and_request_cannot_be_serviced()
        {
            var undefinedId = Guid.NewGuid();

            _ = FakeLibrarySalesAreaPassPrioritiesRepository.Setup(m => m.GetAsync(FakeSalesAreaPassPriority.Uid)).ReturnsAsync(FakeSalesAreaPassPriority);
            _ = FakeTenantSettingsRepository.Setup(x => x.GetDefaultSalesAreaPassPriorityId()).Returns(FakeTenantSettings.DefaultSalesAreaPassPriorityId);

            using (var controller = new LibrarySalesAreaPassPrioritiesController(
                       FakeLibrarySalesAreaPassPrioritiesRepository.Object,
                       FakeTenantSettingsRepository.Object,
                       Mapper, null, null
                       ))
            {
                // Act
                IHttpActionResult actionResult = await controller.Delete(undefinedId);

                // Assert
                Assert.That(actionResult is NotFoundResult);
            }
        }
        public async Task Set_sales_area_pass_priority_as_default_success_200()
        {
            _ = FakeLibrarySalesAreaPassPrioritiesRepository.Setup(m => m.GetAsync(FakeSalesAreaPassPriority.Uid)).ReturnsAsync(FakeSalesAreaPassPriority);
            _ = FakeTenantSettingsRepository.Setup(x => x.Get()).Returns(FakeTenantSettings);

            using (var controller = new LibrarySalesAreaPassPrioritiesController(
                       FakeLibrarySalesAreaPassPrioritiesRepository.Object,
                       FakeTenantSettingsRepository.Object,
                       Mapper, null, null
                       ))
            {
                // Act
                IHttpActionResult actionResult = await controller.SetDefault(FakeSalesAreaPassPriority.Uid);

                var contentResult = actionResult as OkResult;

                // Assert
                Assert.NotNull(contentResult);
            }
        }
Exemple #4
0
        public async Task Delete_sales_area_pass_priority_which_is_default_expect_422_with_message()
        {
            FakeSalesAreaPassPriority.Uid = FakeTenantSettings.DefaultSalesAreaPassPriorityId;
            _ = FakeLibrarySalesAreaPassPrioritiesRepository.Setup(m => m.GetAsync(FakeSalesAreaPassPriority.Uid)).ReturnsAsync(FakeSalesAreaPassPriority);
            _ = FakeTenantSettingsRepository.Setup(x => x.GetDefaultSalesAreaPassPriorityId()).Returns(FakeTenantSettings.DefaultSalesAreaPassPriorityId);

            using (var controller = new LibrarySalesAreaPassPrioritiesController(
                       FakeLibrarySalesAreaPassPrioritiesRepository.Object,
                       FakeTenantSettingsRepository.Object,
                       Mapper, null, null
                       ))
            {
                // Act
                IHttpActionResult actionResult = await controller.Delete(FakeTenantSettings.DefaultSalesAreaPassPriorityId);

                var response = actionResult as UnprocessableEntityResult;

                // Assert
                Assert.NotNull(response);
            }
        }
        public async Task Set_sales_area_pass_priority_nonexisting_id_404()
        {
            var nonExistingSalesAreaPassPriorityId = Guid.NewGuid();

            _ = FakeLibrarySalesAreaPassPrioritiesRepository.Setup(m => m.GetAsync(FakeSalesAreaPassPriority.Uid)).ReturnsAsync(FakeSalesAreaPassPriority);
            _ = FakeTenantSettingsRepository.Setup(x => x.Get()).Returns(FakeTenantSettings);

            using (var controller = new LibrarySalesAreaPassPrioritiesController(
                       FakeLibrarySalesAreaPassPrioritiesRepository.Object,
                       FakeTenantSettingsRepository.Object,
                       Mapper, null, null
                       ))
            {
                // Act
                IHttpActionResult actionResult = await controller.SetDefault(nonExistingSalesAreaPassPriorityId);

                var notFoundResult = actionResult as NotFoundResult;

                // Assert
                Assert.NotNull(notFoundResult);
            }
        }