private Dictionary <string, ExpectedAttributeValue> ToExpectedAttributeMap(DynamoDBEntryConversion conversion, IEnumerable <string> epochAttributes, bool isEmptyStringValueEnabled) { Dictionary <string, ExpectedAttributeValue> ret = new Dictionary <string, ExpectedAttributeValue>(); foreach (var kvp in ExpectedValues) { string attributeName = kvp.Key; ExpectedValue expectedValue = kvp.Value; ExpectedAttributeValue eav; if (epochAttributes != null && epochAttributes.Contains(attributeName)) { var values = expectedValue.Values.Select(p => Document.DateTimeToEpochSeconds(p, attributeName)).ToList(); eav = ExpectedValue.ToExpectedAttributeValue(expectedValue.Exists, values, expectedValue.Comparison, conversion, isEmptyStringValueEnabled); } else { eav = expectedValue.ToExpectedAttributeValue(conversion, isEmptyStringValueEnabled); } ret[attributeName] = eav; } return(ret); }
/// <summary> /// Creates a map of attribute names mapped to ExpectedAttributeValue objects. /// </summary> /// <param name="conversion">Conversion to use for converting .NET values to DynamoDB values.</param> /// <returns></returns> public Dictionary <string, ExpectedAttributeValue> ToExpectedAttributeMap(DynamoDBEntryConversion conversion) { Dictionary <string, ExpectedAttributeValue> ret = new Dictionary <string, ExpectedAttributeValue>(); foreach (var kvp in ExpectedValues) { string attributeName = kvp.Key; ExpectedValue expectedValue = kvp.Value; ExpectedAttributeValue eav = expectedValue.ToExpectedAttributeValue(conversion); ret[attributeName] = eav; } return(ret); }
/// <summary> /// Adds an ExpectedValue with the specific Comparison and Values for the attribute. /// </summary> /// <param name="attributeName">Attribute that is being tested</param> /// <param name="comparison">Comparison operator for the expected value.</param> /// <param name="values">Values to compare the attribute against.</param> public void AddExpected(string attributeName, ScanOperator comparison, params Primitive[] values) { ExpectedValues[attributeName] = new ExpectedValue(comparison, values); }
/// <summary> /// Adds an ExpectedValue with the specific Exists value for the attribute. /// </summary> /// <param name="attributeName">Attribute that is being tested</param> /// <param name="exists">Flag whether the attribute should exist or not.</param> public void AddExpected(string attributeName, bool exists) { ExpectedValues[attributeName] = new ExpectedValue(exists); }