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); }
private SerializedItemDescriptor Serialize(DataKind kind, ItemDescriptor itemDesc) { return(new SerializedItemDescriptor(itemDesc.Version, itemDesc.Item is null, kind.Serialize(itemDesc))); }
public static void DataItemsEqual(DataKind kind, ItemDescriptor expected, ItemDescriptor actual) { AssertJsonEqual(kind.Serialize(expected), kind.Serialize(actual)); Assert.Equal(expected.Version, actual.Version); }
private static bool ItemsEqual(DataKind kind, ItemDescriptor expected, ItemDescriptor actual) => LdValue.Parse(kind.Serialize(actual)) == LdValue.Parse(kind.Serialize(expected));
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))) + "]";
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); }