public static bool ListContains(List <ManyDataTypesEntity> expectedEntities, ManyDataTypesEntity actualEntity) { foreach (var expectedEntity in expectedEntities) { try { expectedEntity.AssertEquals(actualEntity); return(true); } catch (AssertionException) { } } return(false); }
public static ManyDataTypesEntity GetRandomInstance() { Dictionary <string, long> dictionaryStringLong = new Dictionary <string, long>() { { "key_" + Randomm.RandomAlphaNum(10), (long)1234321 } }; Dictionary <string, string> dictionaryStringString = new Dictionary <string, string>() { { "key_" + Randomm.RandomAlphaNum(10), "value_" + Randomm.RandomAlphaNum(10) } }; List <Guid> listOfGuidsType = new List <Guid>() { Guid.NewGuid(), Guid.NewGuid() }; List <string> listOfStringsType = new List <string>() { Randomm.RandomAlphaNum(20), Randomm.RandomAlphaNum(12), "" }; ManyDataTypesEntity randomRow = new ManyDataTypesEntity { StringType = "StringType_val_" + Randomm.RandomAlphaNum(10), GuidType = Guid.NewGuid(), DateTimeType = DateTime.Now.ToUniversalTime(), DateTimeOffsetType = new DateTimeOffset(), BooleanType = false, DecimalType = (decimal)98765432.0, DoubleType = (double)9876543, FloatType = (float)987654, NullableIntType = null, IntType = 98765, Int64Type = (Int64)9876, //TimeUuidType = TimeUuid.NewId(), //NullableTimeUuidType = null, DictionaryStringLongType = dictionaryStringLong, DictionaryStringStringType = dictionaryStringString, ListOfGuidsType = listOfGuidsType, ListOfStringsType = listOfStringsType, }; return(randomRow); }
public void AssertEquals(ManyDataTypesEntity actualRow) { Assert.AreEqual(StringType, actualRow.StringType); Assert.AreEqual(GuidType, actualRow.GuidType); Assert.AreEqual(DateTimeType.ToString(), actualRow.DateTimeType.ToString()); // 'ToString' rounds to the nearest second Assert.AreEqual(DateTimeOffsetType.ToString(), actualRow.DateTimeOffsetType.ToString()); Assert.AreEqual(BooleanType, actualRow.BooleanType); Assert.AreEqual(DecimalType, actualRow.DecimalType); Assert.AreEqual(DoubleType, actualRow.DoubleType); Assert.AreEqual(FloatType, actualRow.FloatType); Assert.AreEqual(IntType, actualRow.IntType); Assert.AreEqual(Int64Type, actualRow.Int64Type); //Assert.AreEqual(TimeUuidType, actualRow.TimeUuidType); //Assert.AreEqual(NullableTimeUuidType, actualRow.NullableTimeUuidType); Assert.AreEqual(DictionaryStringLongType, actualRow.DictionaryStringLongType); Assert.AreEqual(DictionaryStringStringType, actualRow.DictionaryStringStringType); Assert.AreEqual(ListOfGuidsType, actualRow.ListOfGuidsType); Assert.AreEqual(ListOfStringsType, actualRow.ListOfStringsType); }
public static void AssertListContains(List <ManyDataTypesEntity> expectedEntities, ManyDataTypesEntity actualEntity) { Assert.IsTrue(ListContains(expectedEntities, actualEntity)); }