コード例 #1
0
 public static void DataItemsEqual(DataKind kind, ItemDescriptor expected, ItemDescriptor actual)
 {
     if (!ItemsEqual(kind, expected, actual))
     {
         Assert.True(false, string.Format("expected: {0}\nactual: {1}",
                                          kind.Serialize(expected), kind.Serialize(actual)));
     }
 }
        public void ForceSet(DataKind kind, string key, int version, object item)
        {
            if (!Data.ContainsKey(kind))
            {
                Data[kind] = new Dictionary <string, SerializedItemDescriptor>();
            }
            var serializedItemDesc = new SerializedItemDescriptor(version,
                                                                  item is null, kind.Serialize(new ItemDescriptor(version, item)));

            Data[kind][key] = StorableItem(kind, serializedItemDesc);
        }
コード例 #3
0
 private SerializedItemDescriptor Serialize(DataKind kind, ItemDescriptor itemDesc)
 {
     return(new SerializedItemDescriptor(itemDesc.Version,
                                         itemDesc.Item is null, kind.Serialize(itemDesc)));
 }
コード例 #4
0
 public static void DataItemsEqual(DataKind kind, ItemDescriptor expected, ItemDescriptor actual)
 {
     AssertJsonEqual(kind.Serialize(expected), kind.Serialize(actual));
     Assert.Equal(expected.Version, actual.Version);
 }
コード例 #5
0
 private static bool ItemsEqual(DataKind kind, ItemDescriptor expected, ItemDescriptor actual) =>
 LdValue.Parse(kind.Serialize(actual)) == LdValue.Parse(kind.Serialize(expected));
コード例 #6
0
 private static string DescribeDataCollection(DataKind kind, params KeyValuePair <string, ItemDescriptor>[] items) =>
 kind.Name.ToUpper() + ": [" +
 string.Join(",", items.Select(keyedItem =>
                               "[" + keyedItem.Key + ": " + kind.Serialize(keyedItem.Value)))
 + "]";
コード例 #7
0
 internal void DoUpdate(DataKind kind, string key, ItemDescriptor item)
 {
     _log.Debug("updating \"{0}\" in {1} to {2}", key, kind.Name, LogValues.Defer(() =>
                                                                                  kind.Serialize(item)));
     _updates.Upsert(kind, key, item);
 }