/// <summary> /// Henter alle kontogrupper. /// </summary> /// <returns>Liste af kontogrupper.</returns> public IEnumerable <Kontogruppe> KontogruppeGetAll() { var channel = _channelFactory.CreateChannel <IFinansstyringRepositoryService>(EndpointConfigurationName); try { var query = new KontogruppeGetAllQuery(); var kontogruppeViews = channel.KontogruppeGetAll(query); return(_domainObjectBuilder.BuildMany <KontogruppeView, Kontogruppe>(kontogruppeViews)); } catch (IntranetRepositoryException) { throw; } catch (FaultException ex) { throw new IntranetRepositoryException(ex.Message); } catch (Exception ex) { throw new IntranetRepositoryException( Resource.GetExceptionMessage(ExceptionMessage.RepositoryError, MethodBase.GetCurrentMethod().Name, ex.Message), ex); } finally { ChannelTools.CloseChannel(channel); } }
public void TestThatStaticTextGetAllGetsStaticTextSystemViewCollection() { var client = _channelFactory.CreateChannel(); try { IList <TranslationInfoSystemView> translationInfoCollection = GetTranslationInfoCollection(client); Assert.That(translationInfoCollection, Is.Not.Null); Assert.That(translationInfoCollection, Is.Not.Empty); foreach (var translationInfoSystemView in translationInfoCollection) { StaticTextCollectionGetQuery staticTextCollectionGetQuery = new StaticTextCollectionGetQuery { TranslationInfoIdentifier = translationInfoSystemView.TranslationInfoIdentifier }; IList <StaticTextSystemView> staticTextSystemViewCollection = new List <StaticTextSystemView>(client.StaticTextGetAll(staticTextCollectionGetQuery)); Assert.That(staticTextSystemViewCollection, Is.Not.Null); Assert.That(staticTextSystemViewCollection, Is.Not.Empty); Assert.That(staticTextSystemViewCollection.Count, Is.EqualTo(Enum.GetValues(typeof(StaticTextType)).Cast <StaticTextType>().Count())); } } finally { ChannelTools.CloseChannel(client); } }
public void TestThatFoodGroupTreeGetGetsFoodGroupTree() { var client = _channelFactory.CreateChannel(); try { IList <TranslationInfoSystemView> translationInfoCollection = GetTranslationInfoCollection(client); Assert.That(translationInfoCollection, Is.Not.Null); Assert.That(translationInfoCollection, Is.Not.Empty); foreach (var translationInfo in translationInfoCollection) { var query = new FoodGroupTreeGetQuery { TranslationInfoIdentifier = translationInfo.TranslationInfoIdentifier }; var foodGroupTree = client.FoodGroupTreeGet(query); Assert.That(foodGroupTree, Is.Not.Null); Assert.That(foodGroupTree.FoodGroups, Is.Not.Null); Assert.That(foodGroupTree.FoodGroups.Count(), Is.GreaterThanOrEqualTo(0)); Assert.That(foodGroupTree.DataProvider, Is.Not.Null); } } finally { ChannelTools.CloseChannel(client); } }
public void TestThatStorageTypeGetAllGetGetsStorageTypeViewCollection() { IFoodWasteHouseholdDataService client = _channelFactory.CreateChannel(); try { IList <TranslationInfoSystemView> translationInfoCollection = GetTranslationInfoCollection(client); Assert.That(translationInfoCollection, Is.Not.Null); Assert.That(translationInfoCollection, Is.Not.Empty); foreach (TranslationInfoSystemView translationInfo in translationInfoCollection) { StorageTypeCollectionGetQuery storageTypeCollectionGetQuery = new StorageTypeCollectionGetQuery { TranslationInfoIdentifier = translationInfo.TranslationInfoIdentifier }; IList <StorageTypeView> storageTypeCollection = new List <StorageTypeView>(client.StorageTypeGetAll(storageTypeCollectionGetQuery)); Assert.That(storageTypeCollection, Is.Not.Null); Assert.That(storageTypeCollection, Is.Not.Empty); Assert.That(storageTypeCollection.Count, Is.EqualTo(4)); Assert.That(storageTypeCollection.SingleOrDefault(m => m.StorageTypeIdentifier == StorageType.IdentifierForRefrigerator), Is.Not.Null); Assert.That(storageTypeCollection.SingleOrDefault(m => m.StorageTypeIdentifier == StorageType.IdentifierForFreezer), Is.Not.Null); Assert.That(storageTypeCollection.SingleOrDefault(m => m.StorageTypeIdentifier == StorageType.IdentifierForKitchenCabinets), Is.Not.Null); Assert.That(storageTypeCollection.SingleOrDefault(m => m.StorageTypeIdentifier == StorageType.IdentifierForShoppingBasket), Is.Not.Null); } } finally { ChannelTools.CloseChannel(client); } }
public void TestThatDataProviderWhoHandlesPaymentsCollectionGetGetsDataProviderWhoHandlesPaymentsCollecti() { var client = _channelFactory.CreateChannel(); try { IList <TranslationInfoSystemView> translationInfoCollection = GetTranslationInfoCollection(client); Assert.That(translationInfoCollection, Is.Not.Null); Assert.That(translationInfoCollection, Is.Not.Empty); foreach (var translationInfo in translationInfoCollection) { var dataProviderWhoHandlesPaymentsCollectionGetQuery = new DataProviderWhoHandlesPaymentsCollectionGetQuery { TranslationInfoIdentifier = translationInfo.TranslationInfoIdentifier }; IList <DataProviderView> dataProviderWhoHandlesPaymentsCollection = new List <DataProviderView>(client.DataProviderWhoHandlesPaymentsCollectionGet(dataProviderWhoHandlesPaymentsCollectionGetQuery)); Assert.That(dataProviderWhoHandlesPaymentsCollection, Is.Not.Null); Assert.That(dataProviderWhoHandlesPaymentsCollection, Is.Not.Empty); } } finally { ChannelTools.CloseChannel(client); } }
public void TestThatHouseholdDataGetThrowsFaultExceptionWhenHouseholdMemberHasNotBeenCreated() { var client = _channelFactory.CreateChannel(); try { IList <TranslationInfoSystemView> translationInfoCollection = GetTranslationInfoCollection(client); Assert.That(translationInfoCollection, Is.Not.Null); Assert.That(translationInfoCollection, Is.Not.Empty); foreach (var translationInfo in translationInfoCollection) { HouseholdDataGetQuery householdDataGetQuery = new HouseholdDataGetQuery { HouseholdIdentifier = Guid.NewGuid(), TranslationInfoIdentifier = translationInfo.TranslationInfoIdentifier }; FaultException <FoodWasteFault> faultException = Assert.Throws <FaultException <FoodWasteFault> >(() => client.HouseholdDataGet(householdDataGetQuery)); TestHelper.AssertFaultExceptionWithFoodWasteFault(faultException, FoodWasteFaultType.BusinessFault, SoapNamespaces.FoodWasteHouseholdDataServiceName, "HouseholdDataGet", ExceptionMessage.HouseholdMemberNotCreated); } } finally { ChannelTools.CloseChannel(client); } }
public void TestThatHouseholdAddThrowsFaultExceptionWhenHouseholdCouldNotBeCreated() { var client = _channelFactory.CreateChannel(); try { IList <TranslationInfoSystemView> translationInfoCollection = GetTranslationInfoCollection(client); Assert.That(translationInfoCollection, Is.Not.Null); Assert.That(translationInfoCollection, Is.Not.Empty); foreach (var translationInfo in translationInfoCollection) { HouseholdAddCommand householdAddCommand = new HouseholdAddCommand { Name = null, Description = null, TranslationInfoIdentifier = translationInfo.TranslationInfoIdentifier }; FaultException <FoodWasteFault> faultException = Assert.Throws <FaultException <FoodWasteFault> >(() => client.HouseholdAdd(householdAddCommand)); TestHelper.AssertFaultExceptionWithFoodWasteFault(faultException, FoodWasteFaultType.BusinessFault, SoapNamespaces.FoodWasteHouseholdDataServiceName, "HouseholdAdd", ExceptionMessage.ValueMustBeGivenForProperty, "Name"); } } finally { ChannelTools.CloseChannel(client); } }
public void TestThatHouseholdAddHouseholdMemberThrowsFaultExceptionWhenHouseholdMemberHasNotBeenCreated() { var client = _channelFactory.CreateChannel(); try { IList <TranslationInfoSystemView> translationInfoCollection = GetTranslationInfoCollection(client); Assert.That(translationInfoCollection, Is.Not.Null); Assert.That(translationInfoCollection, Is.Not.Empty); foreach (var translationInfo in translationInfoCollection) { HouseholdAddHouseholdMemberCommand householdAddHouseholdMemberCommand = new HouseholdAddHouseholdMemberCommand { HouseholdIdentifier = Guid.NewGuid(), MailAddress = $"test.{Guid.NewGuid().ToString("D").ToLower()}@osdevgrp.dk", TranslationInfoIdentifier = translationInfo.TranslationInfoIdentifier }; FaultException <FoodWasteFault> faultException = Assert.Throws <FaultException <FoodWasteFault> >(() => client.HouseholdAddHouseholdMember(householdAddHouseholdMemberCommand)); TestHelper.AssertFaultExceptionWithFoodWasteFault(faultException, FoodWasteFaultType.BusinessFault, SoapNamespaces.FoodWasteHouseholdDataServiceName, "HouseholdAddHouseholdMember", ExceptionMessage.HouseholdMemberNotCreated); } } finally { ChannelTools.CloseChannel(client); } }
/// <summary> /// Henter alle betalingsbetingelser. /// </summary> /// <returns>Liste af betalingsbetingelser.</returns> public IEnumerable <Betalingsbetingelse> BetalingsbetingelseGetAll() { var channel = _channelFactory.CreateChannel <IAdresseRepositoryService>(EndpointConfigurationName); try { var query = new BetalingsbetingelseGetAllQuery(); var betalingsbetingelseViews = channel.BetalingsbetingelseGetAll(query); return (_domainObjectBuilder.BuildMany <BetalingsbetingelseView, Betalingsbetingelse>( betalingsbetingelseViews)); } catch (IntranetRepositoryException) { throw; } catch (FaultException ex) { throw new IntranetRepositoryException(ex.Message); } catch (Exception ex) { throw new IntranetRepositoryException( Resource.GetExceptionMessage(ExceptionMessage.RepositoryError, MethodBase.GetCurrentMethod().Name, ex.Message), ex); } finally { ChannelTools.CloseChannel(channel); } }
public void TestAtFaultExceptionKastesVedOprettelseHvisNavnErEmpty() { var container = ContainerFactory.Create(); var channelFactory = container.Resolve <IChannelFactory>(); var channel = channelFactory.CreateChannel <IFællesRepositoryService>("FællesRepositoryService"); try { var command = new BrevhovedAddCommand { Nummer = 99, Navn = string.Empty, Linje1 = "_Test 1", Linje2 = "_Test 2", Linje3 = "_Test 3", Linje4 = "_Test 4", Linje5 = "_Test 5", Linje6 = "_Test 6", Linje7 = "_Test 7", }; Assert.Throws <FaultException>(() => channel.BrevhovedAdd(command)); } finally { ChannelTools.CloseChannel(channel); } }
public void TestThatPrivacyPolicyGetGetsStaticTextViewForPrivacyPolicy() { var client = _channelFactory.CreateChannel(); try { IList <TranslationInfoSystemView> translationInfoCollection = GetTranslationInfoCollection(client); Assert.That(translationInfoCollection, Is.Not.Null); Assert.That(translationInfoCollection, Is.Not.Empty); foreach (var translationInfoSystemView in translationInfoCollection) { var privacyPolicyGetQuery = new PrivacyPolicyGetQuery { TranslationInfoIdentifier = translationInfoSystemView.TranslationInfoIdentifier }; var staticTextView = client.PrivacyPolicyGet(privacyPolicyGetQuery); Assert.That(staticTextView, Is.Not.Null); Assert.That(staticTextView.StaticTextType, Is.EqualTo((int)StaticTextType.PrivacyPolicy)); Assert.That(staticTextView.SubjectTranslation, Is.Not.Null); Assert.That(staticTextView.SubjectTranslation, Is.Not.Empty); Assert.That(staticTextView.BodyTranslation, Is.Not.Null); Assert.That(staticTextView.BodyTranslation, Is.Not.Empty); } } finally { ChannelTools.CloseChannel(client); } }
public void TestThatFoodItemImportFromDataProviderImportsFoodItems() { var client = _channelFactory.CreateChannel(); try { IList <TranslationInfoSystemView> translationInfoCollection = GetTranslationInfoCollection(client); Assert.That(translationInfoCollection, Is.Not.Null); Assert.That(translationInfoCollection, Is.Not.Empty); var foodGroupTree = client.FoodGroupTreeGet(new FoodGroupTreeGetQuery { TranslationInfoIdentifier = translationInfoCollection.First().TranslationInfoIdentifier }); Assert.That(foodGroupTree, Is.Not.Null); foreach (var command in TestHelper.GetFoodItemImportFromDataProviderCommands(foodGroupTree, translationInfoCollection)) { var result = client.FoodItemImportFromDataProvider(command); Assert.That(result, Is.Not.Null); Assert.That(result.Identifier, Is.Not.EqualTo(default(Guid))); Assert.That(result.Identifier, Is.Not.EqualTo(Guid.Empty)); Assert.That(result.EventDate, Is.EqualTo(DateTime.Now).Within(5).Seconds); } } finally { ChannelTools.CloseChannel(client); } }
public void TestAtFaultExceptionKastesVedOpdateringHvisNavnErEmpty() { var container = ContainerFactory.Create(); var channelFactory = container.Resolve <IChannelFactory>(); var channel = channelFactory.CreateChannel <IFællesRepositoryService>("FællesRepositoryService"); try { var query = new BrevhovedGetAllQuery(); var brevhoveder = channel.BrevhovedGetAll(query); Assert.That(brevhoveder, Is.Not.Null); Assert.That(brevhoveder.Count(), Is.GreaterThan(0)); var brevhoved = brevhoveder.SingleOrDefault(m => m.Nummer == 1); Assert.That(brevhoved, Is.Not.Null); var command = new BrevhovedModifyCommand { Nummer = brevhoved.Nummer, Navn = string.Empty, Linje1 = brevhoved.Linje1, Linje2 = brevhoved.Linje2, Linje3 = brevhoved.Linje3, Linje4 = brevhoved.Linje4, Linje5 = brevhoved.Linje5, Linje6 = brevhoved.Linje6, Linje7 = brevhoved.Linje7, }; Assert.Throws <FaultException>(() => channel.BrevhovedModify(command)); } finally { ChannelTools.CloseChannel(channel); } }
/// <summary> /// Henter alle brevhoveder. /// </summary> /// <returns>Liste af brevhoveder.</returns> public IEnumerable <Brevhoved> BrevhovedGetAll() { IFællesRepositoryService channel = _channelFactory.CreateChannel <IFællesRepositoryService>(EndpointConfigurationName); try { BrevhovedGetAllQuery query = new BrevhovedGetAllQuery(); IEnumerable <BrevhovedView> brevhovedViews = channel.BrevhovedGetAll(query); return(_domainObjectBuilder.BuildMany <BrevhovedView, Brevhoved>(brevhovedViews)); } catch (IntranetRepositoryException) { throw; } catch (FaultException ex) { throw new IntranetRepositoryException(ex.Message); } catch (Exception ex) { throw new IntranetRepositoryException(Resource.GetExceptionMessage(ExceptionMessage.RepositoryError, MethodBase.GetCurrentMethod().Name, ex.Message), ex); } finally { ChannelTools.CloseChannel(channel); } }
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); } }
/// <summary> /// Henter et givent regnskab. /// </summary> /// <param name="nummer">Unik identifikation af regnskabet.</param> /// <param name="getBrevhovedCallback">Callbackmetode til at hente et givent brevhoved.</param> /// <param name="getAdresseCallback">Callbackmetode til at hente en given adresse.</param> /// <returns>Regnskab.</returns> public Regnskab RegnskabGet(int nummer, Func <int, Brevhoved> getBrevhovedCallback, Func <int, AdresseBase> getAdresseCallback) { if (getBrevhovedCallback == null) { throw new ArgumentNullException("getBrevhovedCallback"); } if (getAdresseCallback == null) { throw new ArgumentNullException("getAdresseCallback"); } var channel = _channelFactory.CreateChannel <IFinansstyringRepositoryService>(EndpointConfigurationName); try { // Hent regnskabet. var regnskabQuery = new RegnskabGetByNummerQuery { Regnskabsnummer = nummer }; var regnskabView = channel.RegnskabGetByNummer(regnskabQuery); // Hent alle kontogrupper. var kontogruppeQuery = new KontogruppeGetAllQuery(); var kontogruppeViews = channel.KontogruppeGetAll(kontogruppeQuery); // Hent alle budgetkontogrupper. var budgetkontogruppeQuery = new BudgetkontogruppeGetAllQuery(); var budgetkontogruppeViews = channel.BudgetkontogruppeGetAll(budgetkontogruppeQuery); // Mapning af regnskab. var kontogruppelisteHelper = new KontogruppelisteHelper( _domainObjectBuilder.BuildMany <KontogruppeView, Kontogruppe>(kontogruppeViews)); var budgetkontogruppelisteHelper = new BudgetkontogruppelisteHelper( _domainObjectBuilder.BuildMany <BudgetkontogruppeView, Budgetkontogruppe>(budgetkontogruppeViews)); _domainObjectBuilder.GetKontogruppeCallback = kontogruppelisteHelper.GetById; _domainObjectBuilder.GetBudgetkontogruppeCallback = budgetkontogruppelisteHelper.GetById; _domainObjectBuilder.GetBrevhovedCallback = getBrevhovedCallback; _domainObjectBuilder.GetAdresseBaseCallback = getAdresseCallback; return(_domainObjectBuilder.Build <RegnskabView, Regnskab>(regnskabView)); } catch (IntranetRepositoryException) { throw; } catch (FaultException ex) { throw new IntranetRepositoryException(ex.Message); } catch (Exception ex) { throw new IntranetRepositoryException( Resource.GetExceptionMessage(ExceptionMessage.RepositoryError, MethodBase.GetCurrentMethod().Name, ex.Message), ex); } finally { ChannelTools.CloseChannel(channel); } }
public void TestAtBogføringslinjerKanOprettes() { var client = _channelFactory.CreateChannel <IFinansstyringService>(ClientEndpointName); try { var dato = DateTime.Now; var query = new KontoGetQuery { Regnskabsnummer = 1, Kontonummer = "DANKORT", StatusDato = dato }; var konto = client.KontoGet(query); Assert.That(konto, Is.Not.Null); var saldoBeforeTest = konto.Saldo; var command = new BogføringslinjeOpretCommand { Regnskabsnummer = konto.Regnskab.Nummer, Dato = dato, Kontonummer = konto.Kontonummer, Tekst = "Test fra Services", Budgetkontonummer = "8990", Debit = 5000M }; var result = client.BogføringslinjeOpret(command); Assert.That(result, Is.Not.Null); Assert.That(result.Løbenr, Is.GreaterThan(0)); konto = client.KontoGet(query); Assert.That(konto, Is.Not.Null); Assert.That(konto.Saldo, Is.EqualTo(saldoBeforeTest + command.Debit)); command = new BogføringslinjeOpretCommand { Regnskabsnummer = command.Regnskabsnummer, Dato = command.Dato, Kontonummer = command.Kontonummer, Tekst = command.Tekst, Budgetkontonummer = command.Budgetkontonummer, Kredit = command.Debit }; result = client.BogføringslinjeOpret(command); Assert.That(result, Is.Not.Null); Assert.That(result.Løbenr, Is.GreaterThan(0)); konto = client.KontoGet(query); Assert.That(konto, Is.Not.Null); Assert.That(konto.Saldo, Is.EqualTo(saldoBeforeTest)); } finally { ChannelTools.CloseChannel(client); } }
/// <summary> /// Henter alle adresser. /// </summary> /// <returns>Liste af adresser.</returns> public IEnumerable <AdresseBase> AdresseGetAll() { var channel = _channelFactory.CreateChannel <IAdresseRepositoryService>(EndpointConfigurationName); try { // Henter alle adressegrupper. var adressegruppeQuery = new AdressegruppeGetAllQuery(); var adressegruppeViews = channel.AdressegruppeGetAll(adressegruppeQuery); // Henter alle betalingsbetingelser. var betalingsbetingelseQuery = new BetalingsbetingelseGetAllQuery(); var betalingsbetingelseViews = channel.BetalingsbetingelseGetAll(betalingsbetingelseQuery); // Henter alle firmaadresser. var firmaQuery = new FirmaGetAllQuery(); var firmaViews = channel.FirmaGetAll(firmaQuery); // Henter alle personadresser. var personQuery = new PersonGetAllQuery(); var personViews = channel.PersonGetAll(personQuery); // Mapper views til adresser. lock (SyncRoot) { var adresser = new List <AdresseBase>(); var adressegruppelisteHelper = new AdressegruppelisteHelper(_domainObjectBuilder.BuildMany <AdressegruppeView, Adressegruppe>(adressegruppeViews)); var betalingsbetingelselisteHelper = new BetalingsbetingelselisteHelper(_domainObjectBuilder.BuildMany <BetalingsbetingelseView, Betalingsbetingelse>(betalingsbetingelseViews)); var adresselisteHelper = new AdresselisteHelper(adresser); _domainObjectBuilder.GetAdressegruppeCallback = adressegruppelisteHelper.GetById; _domainObjectBuilder.GetBetalingsbetingelseCallback = betalingsbetingelselisteHelper.GetById; _domainObjectBuilder.GetAdresseBaseCallback = adresselisteHelper.GetById; adresser.AddRange(_domainObjectBuilder.BuildMany <FirmaView, AdresseBase>(firmaViews)); adresser.AddRange(_domainObjectBuilder.BuildMany <PersonView, AdresseBase>(personViews)); return(adresser.OrderBy(m => m, new AdresseComparer()).ToList()); } } catch (IntranetRepositoryException) { throw; } catch (FaultException ex) { throw new IntranetRepositoryException(ex.Message); } catch (Exception ex) { throw new IntranetRepositoryException(Resource.GetExceptionMessage(ExceptionMessage.RepositoryError, MethodBase.GetCurrentMethod().Name, ex.Message), ex); } finally { ChannelTools.CloseChannel(channel); } }
public void TestThatHouseholdMemberAcceptPrivacyPolicyThrowsFaultExceptionWhenHouseholdMemberHasNotBeenCreated() { var client = _channelFactory.CreateChannel(); try { FaultException <FoodWasteFault> faultException = Assert.Throws <FaultException <FoodWasteFault> >(() => client.HouseholdMemberAcceptPrivacyPolicy(new HouseholdMemberAcceptPrivacyPolicyCommand())); TestHelper.AssertFaultExceptionWithFoodWasteFault(faultException, FoodWasteFaultType.BusinessFault, SoapNamespaces.FoodWasteHouseholdDataServiceName, "HouseholdMemberAcceptPrivacyPolicy", ExceptionMessage.HouseholdMemberNotCreated); } finally { ChannelTools.CloseChannel(client); } }
public void TestAtCommonServiceKanHostes() { var uri = new Uri("http://localhost:7000/OSIntranet/"); var host = new ServiceHost(typeof(CommonService), new[] { uri }); try { host.Open(); Assert.That(host.State, Is.EqualTo(CommunicationState.Opened)); } finally { ChannelTools.CloseChannel(host); } }
public void TestAtBrevhovedOpdateres() { var container = ContainerFactory.Create(); var channelFactory = container.Resolve <IChannelFactory>(); var channel = channelFactory.CreateChannel <IFællesRepositoryService>("FællesRepositoryService"); try { var query = new BrevhovedGetAllQuery(); var brevhoveder = channel.BrevhovedGetAll(query); Assert.That(brevhoveder, Is.Not.Null); Assert.That(brevhoveder.Count(), Is.GreaterThan(0)); var brevhoved = brevhoveder.SingleOrDefault(m => m.Nummer == 1); Assert.That(brevhoved, Is.Not.Null); var command = new BrevhovedModifyCommand { Nummer = brevhoved.Nummer, Navn = string.Format("_{0}", brevhoved.Navn), Linje1 = brevhoved.Linje1, Linje2 = brevhoved.Linje2, Linje3 = brevhoved.Linje3, Linje4 = brevhoved.Linje4, Linje5 = brevhoved.Linje5, Linje6 = brevhoved.Linje6, Linje7 = brevhoved.Linje7, CvrNr = brevhoved.CvrNr }; var result = channel.BrevhovedModify(command); Assert.That(result, Is.Not.Null); Assert.That(result.Nummer, Is.EqualTo(command.Nummer)); Assert.That(result.Navn, Is.Not.Null); Assert.That(result.Navn, Is.EqualTo(command.Navn)); Assert.That(result.Linje1, Is.EqualTo(command.Linje1)); Assert.That(result.Linje2, Is.EqualTo(command.Linje2)); Assert.That(result.Linje3, Is.EqualTo(command.Linje3)); Assert.That(result.Linje4, Is.EqualTo(command.Linje4)); Assert.That(result.Linje5, Is.EqualTo(command.Linje5)); Assert.That(result.Linje6, Is.EqualTo(command.Linje6)); Assert.That(result.Linje7, Is.EqualTo(command.Linje7)); Assert.That(result.CvrNr, Is.EqualTo(command.CvrNr)); } finally { ChannelTools.CloseChannel(channel); } }
public void TestAtPersonlisteHentes() { var client = _channelFactory.CreateChannel <IAdressekartotekService>(ClientEndpointName); try { var query = new PersonlisteGetQuery(); var result = client.PersonlisteGet(query); Assert.That(result, Is.Not.Null); Assert.That(result.Count(), Is.GreaterThan(0)); } finally { ChannelTools.CloseChannel(client); } }
public void TestAtBrevhovederKanHentes() { var client = _channelFactory.CreateChannel <IFinansstyringService>(ClientEndpointName); try { var query = new BrevhovederGetQuery(); var result = client.BrevhovederGet(query); Assert.That(result, Is.Not.Null); Assert.That(result.Count(), Is.GreaterThan(0)); } finally { ChannelTools.CloseChannel(client); } }
public void TestAtSystemerHentes() { var client = _channelFactory.CreateChannel <ICommonService>(ClientEndpointName); try { var query = new SystemerGetQuery(); var result = client.SystemerGet(query); Assert.That(result, Is.Not.Null); Assert.That(result.Count(), Is.GreaterThan(0)); } finally { ChannelTools.CloseChannel(client); } }
public void TestThatDataProviderGetAllGetsDataProviderSystemViewCollection() { var client = _channelFactory.CreateChannel(); try { DataProviderCollectionGetQuery dataProviderCollectionGetQuery = new DataProviderCollectionGetQuery(); IList <DataProviderSystemView> dataProviderSystemViewCollection = new List <DataProviderSystemView>(client.DataProviderGetAll(dataProviderCollectionGetQuery)); Assert.That(dataProviderSystemViewCollection, Is.Not.Null); Assert.That(dataProviderSystemViewCollection, Is.Not.Empty); } finally { ChannelTools.CloseChannel(client); } }
public void TestThatHouseholdMemberIsCreatedReturnsBooleanResultWhereResultIsFalse() { var client = _channelFactory.CreateChannel(); try { var booleanResult = client.HouseholdMemberIsCreated(new HouseholdMemberIsCreatedQuery()); Assert.That(booleanResult, Is.Not.Null); Assert.That(booleanResult.Result, Is.EqualTo(false)); Assert.That(booleanResult.EventDate, Is.EqualTo(DateTime.Now).Within(3).Seconds); } finally { ChannelTools.CloseChannel(client); } }
public void TestThatTranslationInfoGetAllGetsTranslationInfoSystemViewCollection() { var client = _channelFactory.CreateChannel(); try { TranslationInfoCollectionGetQuery translationInfoCollectionGetQuery = new TranslationInfoCollectionGetQuery(); IList <TranslationInfoSystemView> translationInfoSystemViewCollection = new List <TranslationInfoSystemView>(client.TranslationInfoGetAll(translationInfoCollectionGetQuery)); Assert.That(translationInfoSystemViewCollection, Is.Not.Null); Assert.That(translationInfoSystemViewCollection, Is.Not.Empty); } finally { ChannelTools.CloseChannel(client); } }
public void TestThatFoodItemCollectionGetGetsFoodItemCollection() { var client = _channelFactory.CreateChannel(); try { IList <TranslationInfoSystemView> translationInfoCollection = GetTranslationInfoCollection(client); Assert.That(translationInfoCollection, Is.Not.Null); Assert.That(translationInfoCollection, Is.Not.Empty); foreach (var translationInfo in translationInfoCollection) { var foodGroupTreeGetQuery = new FoodGroupTreeGetQuery { TranslationInfoIdentifier = translationInfo.TranslationInfoIdentifier }; var foodGroupTree = client.FoodGroupTreeGet(foodGroupTreeGetQuery); Assert.That(foodGroupTree, Is.Not.Null); Assert.That(foodGroupTree.FoodGroups, Is.Not.Null); var foodGroupIdentifiers = new List <Guid?> { null }; if (foodGroupTree.FoodGroups.Any()) { foodGroupIdentifiers.Add(foodGroupTree.FoodGroups.Take(1).ElementAt(0).FoodGroupIdentifier); } foreach (var foodGroupIdentifier in foodGroupIdentifiers) { var foodItemCollectionGetQuery = new FoodItemCollectionGetQuery { TranslationInfoIdentifier = translationInfo.TranslationInfoIdentifier, FoodGroupIdentifier = foodGroupIdentifier }; var foodItemCollection = client.FoodItemCollectionGet(foodItemCollectionGetQuery); Assert.That(foodItemCollection, Is.Not.Null); Assert.That(foodItemCollection.FoodItems, Is.Not.Null); Assert.That(foodItemCollection.FoodItems.Count(), Is.GreaterThanOrEqualTo(0)); Assert.That(foodItemCollection.DataProvider, Is.Not.Null); } } } finally { ChannelTools.CloseChannel(client); } }
public void TestAtBrevhovederHentes() { var container = ContainerFactory.Create(); var channelFactory = container.Resolve <IChannelFactory>(); var channel = channelFactory.CreateChannel <IFællesRepositoryService>("FællesRepositoryService"); try { var query = new BrevhovedGetAllQuery(); var brevhoveder = channel.BrevhovedGetAll(query); Assert.That(brevhoveder, Is.Not.Null); Assert.That(brevhoveder.Count(), Is.GreaterThan(0)); } finally { ChannelTools.CloseChannel(channel); } }
public void TestThatHouseholdMemberUpgradeMembershipThrowsFaultExceptionWhenHouseholdMemberHasNotBeenCreated(Membership upgradeToMembership) { var client = _channelFactory.CreateChannel(); try { using (new ClaimsPrincipalTestExecutor()) { IList <TranslationInfoSystemView> translationInfoCollection = GetTranslationInfoCollection(client); Assert.That(translationInfoCollection, Is.Not.Null); Assert.That(translationInfoCollection, Is.Not.Empty); foreach (var translationInfo in translationInfoCollection) { var dataProviderWhoHandlesPaymentsCollectionGetQuery = new DataProviderWhoHandlesPaymentsCollectionGetQuery { TranslationInfoIdentifier = translationInfo.TranslationInfoIdentifier }; IList <DataProviderView> dataProviderCollection = new List <DataProviderView>(client.DataProviderWhoHandlesPaymentsCollectionGet(dataProviderWhoHandlesPaymentsCollectionGetQuery)); Assert.That(dataProviderCollection, Is.Not.Null); Assert.That(dataProviderCollection, Is.Not.Empty); foreach (var dataProvider in dataProviderCollection) { HouseholdMemberUpgradeMembershipCommand householdMemberUpgradeMembershipCommand = new HouseholdMemberUpgradeMembershipCommand { Membership = upgradeToMembership.ToString(), DataProviderIdentifier = dataProvider.DataProviderIdentifier, PaymentTime = DateTime.Now, PaymentReference = Guid.NewGuid().ToString("D").ToUpper(), PaymentReceipt = null }; FaultException <FoodWasteFault> faultException = Assert.Throws <FaultException <FoodWasteFault> >(() => client.HouseholdMemberUpgradeMembership(householdMemberUpgradeMembershipCommand)); TestHelper.AssertFaultExceptionWithFoodWasteFault(faultException, FoodWasteFaultType.BusinessFault, SoapNamespaces.FoodWasteHouseholdDataServiceName, "HouseholdMemberUpgradeMembership", ExceptionMessage.HouseholdMemberNotCreated); } } } } finally { ChannelTools.CloseChannel(client); } }