Exemple #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 17;
         hash = hash * 23 + (CountryRegionCode == null ? 0 : CountryRegionCode.GetHashCode());
         hash = hash * 23 + (IsOnlyStateProvinceFlag == default(bool) ? 0 : IsOnlyStateProvinceFlag.GetHashCode());
         hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode());
         hash = hash * 23 + (Name == null ? 0 : Name.GetHashCode());
         hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode());
         hash = hash * 23 + (StateProvinceCode == null ? 0 : StateProvinceCode.GetHashCode());
         hash = hash * 23 + (TerritoryId == default(int) ? 0 : TerritoryId.GetHashCode());
         return(hash);
     }
 }
Exemple #2
0
        public void Test_StateProvinceCodeMgr_StateCodeInsert()
        {
            var connection = new SqliteConnection("DataSource=:memory:");

            connection.Open();

            try {
                var options = new DbContextOptionsBuilder <HOSContext>()
                              .UseSqlite(connection)
                              .Options;

                using (var context = new HOSContext(options))
                {
                    context.Database.EnsureCreated();
                }

                using (var context = new HOSContext(options))
                {
                    IStateProvinceCodeManager stateCodeMgr = new StateProvinceCodeManager(new Repository(context));

                    var stateCode = new StateProvinceCode
                    {
                        ID          = 1,
                        StateCode   = "AK",
                        StateName   = "Alaska",
                        CountryCode = "USA",
                        CreatedBy   = "admin",
                        CreatedOn   = DateTime.Now,
                        UpdatedBy   = "admin",
                        UpdatedOn   = DateTime.Now
                    };

                    stateCodeMgr.Create(stateCode);
                    stateCodeMgr.SaveChanges();

                    var result = stateCodeMgr.GetStateProvinceCode(state => state.StateCode == "AK");
                    Assert.NotNull(result);
                    Assert.Equal(stateCode.StateCode, result.StateCode);
                }
            } finally {
                connection.Close();
            }
        }