Ejemplo n.º 1
0
        public static void ClassInitializa(TestContext context)
        {
            var scope = new BusinessScope
            {
                BusinessScopeId = "0000000000000000000000000000000000000000000000000000000000000001",
                CommodityClass  = "Information Platform",
            };

            brand = new Brand
            {
                Id             = "00000000000000000000000000000001",
                BrandName      = "Choless",
                BusinessScopes = new BusinessScope[] { scope },
                WebSite        = "www.choless.com",
                Headquarters   = new Headquarters
                {
                    HeadquartersId = "headquarters id",
                    Country        = "China",
                    Province       = "Shanghai",
                    City           = "Shanghai",
                    Address        = "No. 800 Dongchuan Road"
                },
                EstablishedTime = new DateTime(2018, 3, 30),
                Description     = "A company to make less choices."
            };
            scope.Brand = brand;
        }
Ejemplo n.º 2
0
        public static void ClassInitialize(TestContext context)
        {
            var brand = new Brand();

            scope = new BusinessScope()
            {
                BusinessScopeId = "0000000000000000000000000000000000000000000000000000000000000001",
                Brand           = brand,
                CommodityClass  = "Information Platform"
            };
        }
Ejemplo n.º 3
0
        public void TestGetBrandsByCommodityClass()
        {
            var scope = new BusinessScope {
                CommodityClass = "Information Platform"
            };
            var brand = new Brand
            {
                Id             = "00000000000000000000000000000001",
                BrandName      = "Choless",
                BusinessScopes = new BusinessScope[] { scope },
                WebSite        = "www.choless.com",
                Headquarters   = new Headquarters
                {
                    HeadquartersId = "headquarters id",
                    Country        = "China",
                    Province       = "Shanghai",
                    City           = "Shanghai",
                    Address        = "No. 800 Dongchuan Road"
                },
                EstablishedTime = new DateTime(2018, 3, 30),
                Description     = "A company to make less choices."
            };

            scope.Brand = brand;
            // Run the test against one instance of the context
            using (var manager = new BrandManager(DatabaseName))
            {
                Console.WriteLine(manager.Database.ProviderName);
                manager.Brands.Add(brand);
                manager.SaveChanges();
            }
            // Use a separate instance of the context to verify correct data was saved to database
            using (var manager = new BrandManager(DatabaseName))
            {
                Console.WriteLine(manager.Database.ProviderName);
                var query = manager.QueryBrandsByCommodityClass("Information Platform");

                Assert.AreEqual(1, query.Count());
                Assert.AreEqual(brand, query.First());
            }
        }
Ejemplo n.º 4
0
        private async Task <StandardBusinessDocument> ConstructStandardBusinessDocument(string instanceGuid, Instance instance)
        {
            DateTime completedTime = DateTime.Now;

            Sender digdirSender = new Sender
            {
                Identifier = new Identifier
                {
                    // 0192 prefix for all Norwegian organisations.
                    Value     = $"0192:{_appSettings.EFormidlingSender}",
                    Authority = "iso6523-actorid-upis"
                }
            };

            List <Receiver> receivers = await GetEFormidlingReceivers(instance);

            Scope scope =
                new Scope
            {
                Identifier         = _appMetadata.EFormidling.Process,
                InstanceIdentifier = Guid.NewGuid().ToString(),
                Type             = "ConversationId",
                ScopeInformation = new List <ScopeInformation>
                {
                    new ScopeInformation
                    {
                        ExpectedResponseDateTime = completedTime.AddHours(2)
                    }
                },
            };

            BusinessScope businessScope = new BusinessScope
            {
                Scope = new List <Scope> {
                    scope
                }
            };

            DocumentIdentification documentIdentification = new DocumentIdentification
            {
                InstanceIdentifier  = instanceGuid,
                Standard            = _appMetadata.EFormidling.Standard,
                TypeVersion         = _appMetadata.EFormidling.TypeVersion,
                CreationDateAndTime = completedTime,
                Type = _appMetadata.EFormidling.Type
            };

            StandardBusinessDocumentHeader sbdHeader = new StandardBusinessDocumentHeader
            {
                HeaderVersion          = "1.0",
                BusinessScope          = businessScope,
                DocumentIdentification = documentIdentification,
                Receiver = receivers,
                Sender   = new List <Sender> {
                    digdirSender
                }
            };

            StandardBusinessDocument sbd = new StandardBusinessDocument
            {
                StandardBusinessDocumentHeader = sbdHeader,
                Arkivmelding = new Arkivmelding {
                    Sikkerhetsnivaa = _appMetadata.EFormidling.SecurityLevel
                },
            };

            return(sbd);
        }
Ejemplo n.º 5
0
 /// <summary>
 ///     Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked            // Overflow is fine, just wrap
     {
         int hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Industry != null)
         {
             hashCode = hashCode * 59 + Industry.GetHashCode();
         }
         if (Classification != null)
         {
             hashCode = hashCode * 59 + Classification.GetHashCode();
         }
         if (ListedDate != null)
         {
             hashCode = hashCode * 59 + ListedDate.GetHashCode();
         }
         if (DelistedDate != null)
         {
             hashCode = hashCode * 59 + DelistedDate.GetHashCode();
         }
         if (RegisteredCapital != null)
         {
             hashCode = hashCode * 59 + RegisteredCapital.GetHashCode();
         }
         if (LegalRepresentative != null)
         {
             hashCode = hashCode * 59 + LegalRepresentative.GetHashCode();
         }
         if (GeneralManager != null)
         {
             hashCode = hashCode * 59 + GeneralManager.GetHashCode();
         }
         if (Secretary != null)
         {
             hashCode = hashCode * 59 + Secretary.GetHashCode();
         }
         if (EmployeeCount != null)
         {
             hashCode = hashCode * 59 + EmployeeCount.GetHashCode();
         }
         if (Province != null)
         {
             hashCode = hashCode * 59 + Province.GetHashCode();
         }
         if (City != null)
         {
             hashCode = hashCode * 59 + City.GetHashCode();
         }
         if (Office != null)
         {
             hashCode = hashCode * 59 + Office.GetHashCode();
         }
         if (Email != null)
         {
             hashCode = hashCode * 59 + Email.GetHashCode();
         }
         if (Website != null)
         {
             hashCode = hashCode * 59 + Website.GetHashCode();
         }
         if (BusinessScope != null)
         {
             hashCode = hashCode * 59 + BusinessScope.GetHashCode();
         }
         if (MainBusiness != null)
         {
             hashCode = hashCode * 59 + MainBusiness.GetHashCode();
         }
         if (Introduction != null)
         {
             hashCode = hashCode * 59 + Introduction.GetHashCode();
         }
         return(hashCode);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        ///     Returns true if StockInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of StockInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(StockInfo other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                     ) &&
                 (
                     Industry == other.Industry ||
                     Industry != null &&
                     Industry.Equals(other.Industry)
                 ) &&
                 (
                     Classification == other.Classification ||
                     Classification != null &&
                     Classification.Equals(other.Classification)
                 ) &&
                 (
                     ListedDate == other.ListedDate ||
                     ListedDate != null &&
                     ListedDate.Equals(other.ListedDate)
                 ) &&
                 (
                     DelistedDate == other.DelistedDate ||
                     DelistedDate != null &&
                     DelistedDate.Equals(other.DelistedDate)
                 ) &&
                 (
                     RegisteredCapital == other.RegisteredCapital ||
                     RegisteredCapital != null &&
                     RegisteredCapital.Equals(other.RegisteredCapital)
                 ) &&
                 (
                     LegalRepresentative == other.LegalRepresentative ||
                     LegalRepresentative != null &&
                     LegalRepresentative.Equals(other.LegalRepresentative)
                 ) &&
                 (
                     GeneralManager == other.GeneralManager ||
                     GeneralManager != null &&
                     GeneralManager.Equals(other.GeneralManager)
                 ) &&
                 (
                     Secretary == other.Secretary ||
                     Secretary != null &&
                     Secretary.Equals(other.Secretary)
                 ) &&
                 (
                     EmployeeCount == other.EmployeeCount ||
                     EmployeeCount != null &&
                     EmployeeCount.Equals(other.EmployeeCount)
                 ) &&
                 (
                     Province == other.Province ||
                     Province != null &&
                     Province.Equals(other.Province)
                 ) &&
                 (
                     City == other.City ||
                     City != null &&
                     City.Equals(other.City)
                 ) &&
                 (
                     Office == other.Office ||
                     Office != null &&
                     Office.Equals(other.Office)
                 ) &&
                 (
                     Email == other.Email ||
                     Email != null &&
                     Email.Equals(other.Email)
                 ) &&
                 (
                     Website == other.Website ||
                     Website != null &&
                     Website.Equals(other.Website)
                 ) &&
                 (
                     BusinessScope == other.BusinessScope ||
                     BusinessScope != null &&
                     BusinessScope.Equals(other.BusinessScope)
                 ) &&
                 (
                     MainBusiness == other.MainBusiness ||
                     MainBusiness != null &&
                     MainBusiness.Equals(other.MainBusiness)
                 ) &&
                 (
                     Introduction == other.Introduction ||
                     Introduction != null &&
                     Introduction.Equals(other.Introduction)
                 ));
        }