public void Constructor_ExpectsInstanciatedList()
        {
            // Arrange
            SpeciesObservationProvenance provenance;

            // Act
            provenance = new SpeciesObservationProvenance();

            // Assert
            Assert.IsNotNull(provenance.Values, "Constructor needs to instanciate the property Values.");
        }
Example #2
0
        private List <SpeciesObservationProvenance> CreateOrderedSpeciesObservationProvenanceList(List <SpeciesObservationProvenance> speciesObservationProvenanceList)
        {
            const string OwnerIdentifier                        = "Owner";
            const string ObserverIdentifier                     = "Observer";
            const string ReporterIdentifier                     = "Reporter";
            const string DataProviderIdentifier                 = "DataProvider";
            SpeciesObservationProvenance ownerProvenance        = null;
            SpeciesObservationProvenance observerProvenance     = null;
            SpeciesObservationProvenance reporterProvenance     = null;
            SpeciesObservationProvenance dataProviderProvenance = null;

            foreach (var speciesObservationProvenance in speciesObservationProvenanceList)
            {
                switch (speciesObservationProvenance.Name)
                {
                case OwnerIdentifier:
                    ownerProvenance = speciesObservationProvenance;
                    break;

                case ObserverIdentifier:
                    observerProvenance = speciesObservationProvenance;
                    break;

                case ReporterIdentifier:
                    reporterProvenance = speciesObservationProvenance;
                    break;

                case DataProviderIdentifier:
                    dataProviderProvenance = speciesObservationProvenance;
                    break;
                }
            }

            List <SpeciesObservationProvenance> orderedProvenances = new List <SpeciesObservationProvenance>();

            if (dataProviderProvenance != null)
            {
                orderedProvenances.Add(dataProviderProvenance);
            }
            if (ownerProvenance != null)
            {
                orderedProvenances.Add(ownerProvenance);
            }
            if (observerProvenance != null)
            {
                orderedProvenances.Add(observerProvenance);
            }
            if (reporterProvenance != null)
            {
                orderedProvenances.Add(reporterProvenance);
            }

            return(orderedProvenances);
        }