Example #1
0
        public Task WhenPublicServiceWasRegisteredALot()
        {
            var random = new Random();
            var data   =
                _fixture.CreateMany <PublicServiceWasRegistered>(random.Next(1, 100))
                .Select(registeredPublicService =>
            {
                var expected = new PublicServiceListItem
                {
                    PublicServiceId        = registeredPublicService.PublicServiceId,
                    Name                   = registeredPublicService.Name,
                    CompetentAuthorityCode = null,
                    CompetentAuthorityName = null,
                    ExportToOrafin         = false,
                };

                return(new
                {
                    events = registeredPublicService,
                    expected
                });
            }).ToList();

            return(new PublicServiceListProjections(new ClockProviderStub(DateTime.Now))
                   .Scenario()
                   .Given(data.Select(d => d.events))
                   .Expect(data
                           .Select(d => d.expected)
                           .Cast <object>()
                           .ToArray()));
        }
        public static void CheckPublicService(
            this PublicServiceListItem publicService)
        {
            if (publicService == null)
            {
                throw new ApiException("Onbestaande dienstverlening.", StatusCodes.Status404NotFound);
            }

            if (publicService.Removed)
            {
                throw new ApiException("Dienstverlening werd verwijderd.", StatusCodes.Status410Gone);
            }
        }
        public PublicServiceControllerTests()
        {
            var dbContextOptions = CreateDbContext();

            _existingPublicServiceId = "DVR000000001";

            var publicServiceListItem = new PublicServiceListItem
            {
                PublicServiceId = _existingPublicServiceId,
                Name            = "Dienstverlening"
            };

            _backofficeContext = new BackofficeContext(dbContextOptions);
            _backofficeContext.PublicServiceList.Add(publicServiceListItem);
            _backofficeContext.SaveChanges();

            _eventMapping      = new EventMapping(EventMapping.DiscoverEventNamesInAssembly(typeof(DomainAssemblyMarker).Assembly));
            _eventDeserializer = new EventDeserializer(JsonConvert.DeserializeObject);
        }
        public void WhenFormattingAListWithOneItemThenTheSecondLineIsTheFormattedItem()
        {
            var id           = "DVR000000001";
            var name         = "KidsID aanvragen";
            var organisation = "OVO000108";
            var service      = new PublicServiceListItem
            {
                PublicServiceId        = id,
                Name                   = name,
                CompetentAuthorityCode = organisation
            };

            _sut
            .FormatList(new[] { service })
            .Split(Environment.NewLine)
            .Should().ContainInOrder(
                "identificator|naam|PubliekeOrganisatie|startdatum|einddatum|",
                $"{id}|{name}|{organisation}|||");
        }
Example #5
0
 private static string FormatLine(PublicServiceListItem item)
 => $"{item.PublicServiceId}|{item.Name}|{item.CompetentAuthorityCode}|||";