public List <DictionaryModel> GetDictionary(DictionaryType type) { if (type.GetHashCode() < 10) { string query = $"SELECT Id, Title FROM {type.ToString()} WHERE Deleted = 0"; var data = hrDb.Dictionaries.FromSqlRaw(query); var res = data.Select(d => new DictionaryModel() { Id = d.Id, Title = d.Title }).ToList(); return(res); } else { string query = $"SELECT Id, Title FROM {type.ToString()} WHERE Deleted = 0"; var data = Db.Dictionaries.FromSqlRaw(query).ToList(); var res = data.Select(d => new DictionaryModel() { Id = d.Id, Title = d.Title }).ToList(); return(res); } }
public void Dictionary_members_are_used_correctly_for_equality_comparison() { var x = new DictionaryType(new Dictionary <string, string> { { "a", "The A" }, { "b", "The B" } }); var y = new DictionaryType(new Dictionary <string, string> { { "a", "The A" }, { "b", "The B" } }); Assert.True(x.Equals(y)); Assert.True(y.Equals(x)); Assert.True(x == y); Assert.False(x != y); Assert.Equal(x.GetHashCode(), y.GetHashCode()); }