@@ -18,6 +18,8 @@ module SimpleTableTypes =
1818 [<RangeKey>]
1919 RangeKey: string
2020
21+ EmptyString: string
22+
2123 Value: int64
2224
2325 Tuple: int64 * int64
@@ -46,6 +48,7 @@ type ``Simple Table Operation Tests``(fixture: TableFixture) =
4648 let mkItem () =
4749 { HashKey = guid ()
4850 RangeKey = guid ()
51+ EmptyString = " "
4952 Value = rand ()
5053 Tuple = rand (), rand ()
5154 Map = seq { for _ in 0 L .. rand () % 5 L -> " K" + guid (), rand () } |> Map.ofSeq
@@ -131,6 +134,23 @@ type ``Simple Table Operation Tests``(fixture: TableFixture) =
131134 test <@ None = deletedItem @>
132135 test <@ not ( table.ContainsKey key) @>
133136
137+ [<Theory>]
138+ [<InlineData( " " ,
139+ " rangeKey" ,
140+ " One or more parameter values are not valid. The AttributeValue for a key attribute cannot contain an empty string value. Key: HashKey" ) >]
141+ [<InlineData( " hashKey" ,
142+ " " ,
143+ " One or more parameter values are not valid. The AttributeValue for a key attribute cannot contain an empty string value. Key: RangeKey" ) >]
144+ [<InlineData( " " ,
145+ " " ,
146+ " One or more parameter values are not valid. The AttributeValue for a key attribute cannot contain an empty string value. Key: HashKey" ) >]
147+ let ``Operations with empty key values should fail with a DynamoDB client error`` ( hashKey , rangeKey , expectedErrorMsg ) =
148+ let value = { mkItem () with HashKey = hashKey; RangeKey = rangeKey }
149+ try
150+ table.PutItem value |> ignore
151+ with :? Amazon.DynamoDBv2.AmazonDynamoDBException as ex ->
152+ test <@ ex.Message = expectedErrorMsg @>
153+
134154 interface IClassFixture< TableFixture>
135155
136156type ``TransactWriteItems tests`` ( fixture : TableFixture ) =
@@ -139,6 +159,7 @@ type ``TransactWriteItems tests``(fixture: TableFixture) =
139159 let mkItem () =
140160 { HashKey = guid ()
141161 RangeKey = guid ()
162+ EmptyString = " "
142163 Value = rand ()
143164 Tuple = rand (), rand ()
144165 Map = seq { for _ in 0 L .. rand () % 5 L -> " K" + guid (), rand () } |> Map.ofSeq
0 commit comments