public void TestAtAdressekontolisteKanHentes() { var query = new AdressekontolisteGetQuery { Regnskabsnummer = 1, StatusDato = new DateTime(2011, 3, 1) }; var result = _service.AdressekontolisteGet(query); Assert.That(result, Is.Not.Null); Assert.That(result.Count(), Is.GreaterThan(0)); }
/// <summary> /// Henter og returnerer en liste af adressekonti. /// </summary> /// <param name="query">Forespørgelse efter en liste af adressekonti.</param> /// <returns>Liste af adressekonti.</returns> public IEnumerable <AdressekontolisteView> Query(AdressekontolisteGetQuery query) { if (query == null) { throw new ArgumentNullException("query"); } var adressekonti = AdressekontoGetAllByRegnskab(query.Regnskabsnummer).ToList(); adressekonti.ForEach(m => m.Calculate(query.StatusDato)); return(MapMany <AdresseBase, AdressekontolisteView>(adressekonti)); }
public void TestAtQueryHenterAdressekonti() { var fixture = new Fixture(); var finansstyringRepository = MockRepository.GenerateMock <IFinansstyringRepository>(); var adresseRepository = MockRepository.GenerateMock <IAdresseRepository>(); adresseRepository.Expect(m => m.AdresseGetAll()) .Return(fixture.CreateMany <Person>(25)); var fællesRepository = MockRepository.GenerateMock <IFællesRepository>(); fællesRepository.Expect(m => m.BrevhovedGetAll()) .Return(fixture.CreateMany <Brevhoved>(3)); var objectMapper = MockRepository.GenerateMock <IObjectMapper>(); objectMapper.Expect( m => m.Map <IEnumerable <AdresseBase>, IEnumerable <AdressekontolisteView> >( Arg <IEnumerable <AdresseBase> > .Is.NotNull)) .Return(fixture.CreateMany <AdressekontolisteView>(25)); fixture.Inject(finansstyringRepository); fixture.Inject(adresseRepository); fixture.Inject(fællesRepository); fixture.Inject(objectMapper); var queryHandler = fixture.Create <AdressekontolisteGetQueryHandler>(); Assert.That(queryHandler, Is.Not.Null); var query = new AdressekontolisteGetQuery { Regnskabsnummer = fixture.Create <int>(), StatusDato = fixture.Create <DateTime>() }; var adressekonti = queryHandler.Query(query); Assert.That(adressekonti, Is.Not.Null); Assert.That(adressekonti.Count(), Is.EqualTo(25)); adresseRepository.AssertWasCalled(m => m.AdresseGetAll()); fællesRepository.AssertWasCalled(m => m.BrevhovedGetAll()); objectMapper.AssertWasCalled( m => m.Map <IEnumerable <AdresseBase>, IEnumerable <AdressekontolisteView> >( Arg <IEnumerable <AdresseBase> > .Is.NotNull)); }
public void TestAtAdressekontolisteKanHentes() { var client = _channelFactory.CreateChannel <IFinansstyringService>(ClientEndpointName); try { var query = new AdressekontolisteGetQuery { Regnskabsnummer = 1, StatusDato = new DateTime(2011, 3, 1) }; var result = client.AdressekontolisteGet(query); Assert.That(result, Is.Not.Null); Assert.That(result.Count(), Is.GreaterThan(0)); } finally { ChannelTools.CloseChannel(client); } }
public IEnumerable <AdressekontolisteView> AdressekontolisteGet(AdressekontolisteGetQuery query) { try { return(_queryBus.Query <AdressekontolisteGetQuery, IEnumerable <AdressekontolisteView> >(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); } }