public void TestAtBrevhovedHentes() { var random = new Random(DateTime.Now.Second); var container = ContainerFactory.Create(); var channelFactory = container.Resolve <IChannelFactory>(); var channel = channelFactory.CreateChannel <IFællesRepositoryService>("FællesRepositoryService"); try { var brevhovedGetAllQuery = new BrevhovedGetAllQuery(); var brevhoveder = channel.BrevhovedGetAll(brevhovedGetAllQuery); Assert.That(brevhoveder, Is.Not.Null); Assert.That(brevhoveder.Count(), Is.GreaterThan(0)); var no = random.Next(0, brevhoveder.Count() - 1); var query = new BrevhovedGetByNummerQuery { Nummer = brevhoveder.ElementAt(no).Nummer }; var brevhoved = channel.BrevhovedGetByNummer(query); Assert.That(brevhoved, Is.Not.Null); Assert.That(brevhoved.Nummer, Is.EqualTo(brevhoveder.ElementAt(no).Nummer)); Assert.That(brevhoved.Navn, Is.Not.Null); Assert.That(brevhoved.Navn, Is.EqualTo(brevhoveder.ElementAt(no).Navn)); } finally { ChannelTools.CloseChannel(channel); } }
public BrevhovedView BrevhovedGetByNummer(BrevhovedGetByNummerQuery brevhovedGetByNummerQuery) { try { return(_queryBus.Query <BrevhovedGetByNummerQuery, BrevhovedView>(brevhovedGetByNummerQuery)); } catch (Exception ex) { throw CreateFault(MethodBase.GetCurrentMethod(), ex, int.Parse(Properties.Resources.EventLogFællesRepositoryService)); } }