public void TheLengthShouldBeBetween1and10ForIDictionary() { var result = RandomValue.IDictionary <DateTime, sbyte>(); result.Count().ShouldBeInRange(1, 10); result.Keys.First().ShouldBeType <DateTime>(); result.Values.First().ShouldBeType <sbyte>(); }
public void TheValuesShouldBeUniqueForIDictionaryWithDateTimeOffset() { var result = RandomValue.IDictionary <DateTimeOffset, ulong>(); var distinctValues = result.Values.Distinct(); distinctValues.Count().ShouldEqual(result.Count()); result.Keys.First().ShouldBeType <DateTimeOffset>(); result.Values.First().ShouldBeType <ulong>(); }
public void TheValuesShouldBeUniqueForIDictionary() { var result = RandomValue.IDictionary <TimeSpan, ulong>(); var distinctValues = result.Values.Distinct(); distinctValues.Count().ShouldEqual(result.Count()); result.Keys.First().ShouldBeType <TimeSpan>(); result.Values.First().ShouldBeType <ulong>(); }
public void AllItemsInTheKeysShouldBeUniqueForAIDictionary() { //There should be keys from 1 - 127. var length = 127; var result = RandomValue.IDictionary <sbyte, short>(length); for (int i = 0; i < length; i++) { result.ContainsKey((sbyte)i).ShouldBeTrue(); } result.Keys.First().ShouldBeType <sbyte>(); result.Values.First().ShouldBeType <short>(); }
public void RandomIDictionaryWithRecursiveWillGenerateChildObjectsToTheSpecifiedDepthWithSettings() { var result = RandomValue.IDictionary <int, ObjectWithRecursiveCollections>(Depth2Settings); result.Count().ShouldBeInRange(1, 3); var depth1 = result.FirstOrDefault(); depth1.Value.RecursiveIDictionary.ShouldNotBeDefault(); depth1.Value.Int.ShouldNotBeDefault(); depth1.Value.RecursiveIDictionary.Count.ShouldBeInRange(1, 3); var depth2 = depth1.Value.RecursiveIDictionary.FirstOrDefault(); depth2.Value.RecursiveIDictionary.ShouldNotBeDefault(); depth2.Value.Int.ShouldNotBeDefault(); depth2.Value.RecursiveIDictionary.Count.ShouldBeInRange(1, 3); var depth3 = depth2.Value.RecursiveIDictionary.FirstOrDefault(); depth3.Value.RecursiveIDictionary.ShouldEqual(null); depth3.Value.Int.ShouldNotBeDefault(); }