public void TestAtQueryHenterBetalingsbetingelser()
        {
            var fixture = new Fixture();

            var adresseRepository = MockRepository.GenerateMock <IAdresseRepository>();

            adresseRepository.Expect(m => m.BetalingsbetingelseGetAll())
            .Return(fixture.CreateMany <Betalingsbetingelse>(2));
            var objectMapper = MockRepository.GenerateMock <IObjectMapper>();

            objectMapper.Expect(
                m =>
                m.Map <IEnumerable <Betalingsbetingelse>, IEnumerable <BetalingsbetingelseView> >(
                    Arg <IEnumerable <Betalingsbetingelse> > .Is.NotNull))
            .Return(fixture.CreateMany <BetalingsbetingelseView>(2));

            fixture.Inject(adresseRepository);
            fixture.Inject(objectMapper);
            var queryHandler = fixture.Create <BetalingsbetingelserGetQueryHandler>();

            Assert.That(queryHandler, Is.Not.Null);

            var query = new BetalingsbetingelserGetQuery();
            var betalingsbetingelser = queryHandler.Query(query);

            Assert.That(betalingsbetingelser, Is.Not.Null);
            Assert.That(betalingsbetingelser.Count(), Is.EqualTo(2));

            adresseRepository.AssertWasCalled(m => m.BetalingsbetingelseGetAll());
            objectMapper.AssertWasCalled(
                m =>
                m.Map <IEnumerable <Betalingsbetingelse>, IEnumerable <BetalingsbetingelseView> >(
                    Arg <IEnumerable <Betalingsbetingelse> > .Is.NotNull));
        }
Пример #2
0
        public void TestAtBetalingsbetingelserKanHentes()
        {
            var query  = new BetalingsbetingelserGetQuery();
            var result = _service.BetalingsbetingelserGet(query);

            Assert.That(result, Is.Not.Null);
            Assert.That(result.Count(), Is.GreaterThan(0));
        }
        /// <summary>
        /// Henter og returnerer betalingsbetingelser.
        /// </summary>
        /// <param name="query">Forespørgelse efter betalingsbetingelser.</param>
        /// <returns>Liste af betalingsbetingelser.</returns>
        public IEnumerable <BetalingsbetingelseView> Query(BetalingsbetingelserGetQuery query)
        {
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }

            var betalingsbetingelser = Repository.BetalingsbetingelseGetAll();

            return(MapMany <Betalingsbetingelse, BetalingsbetingelseView>(betalingsbetingelser));
        }
Пример #4
0
        public void TestAtBetalingsbetingelserKanHentes()
        {
            var client = _channelFactory.CreateChannel <IFinansstyringService>(ClientEndpointName);

            try
            {
                var query  = new BetalingsbetingelserGetQuery();
                var result = client.BetalingsbetingelserGet(query);
                Assert.That(result, Is.Not.Null);
                Assert.That(result.Count(), Is.GreaterThan(0));
            }
            finally
            {
                ChannelTools.CloseChannel(client);
            }
        }
 public IEnumerable <BetalingsbetingelseView> BetalingsbetingelserGet(BetalingsbetingelserGetQuery query)
 {
     try
     {
         return(_queryBus.Query <BetalingsbetingelserGetQuery, IEnumerable <BetalingsbetingelseView> >(query));
     }
     catch (IntranetRepositoryException ex)
     {
         throw CreateIntranetRepositoryFault(ex);
     }
     catch (IntranetBusinessException ex)
     {
         throw CreateIntranetBusinessFault(ex);
     }
     catch (IntranetSystemException ex)
     {
         throw CreateIntranetSystemFault(ex);
     }
     catch (Exception ex)
     {
         throw CreateIntranetSystemFault(ex);
     }
 }