Exemplo n.º 1
0
        public static ManyDataTypesPoco 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), "" };


            ManyDataTypesPoco randomRow = new ManyDataTypesPoco
            {
                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;
        }
Exemplo n.º 2
0
 public static bool ListContains(List <ManyDataTypesPoco> expectedEntities, ManyDataTypesPoco actualEntity)
 {
     foreach (var expectedEntity in expectedEntities)
     {
         try
         {
             expectedEntity.AssertEquals(actualEntity);
             return(true);
         }
         catch (AssertionException) { }
     }
     return(false);
 }
Exemplo n.º 3
0
 public void AssertEquals(ManyDataTypesPoco 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);
 }
Exemplo n.º 4
0
        public static ManyDataTypesPoco 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), ""
            };


            ManyDataTypesPoco randomRow = new ManyDataTypesPoco
            {
                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);
        }
Exemplo n.º 5
0
 public void AssertEquals(ManyDataTypesPoco 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);
 }
Exemplo n.º 6
0
 public static void AssertListContains(List <ManyDataTypesPoco> expectedEntities, ManyDataTypesPoco actualEntity)
 {
     Assert.IsTrue(ListContains(expectedEntities, actualEntity));
 }
Exemplo n.º 7
0
 public static void AssertListContains(List<ManyDataTypesPoco> expectedEntities, ManyDataTypesPoco actualEntity)
 {
     Assert.IsTrue(ListContains(expectedEntities, actualEntity));
 }
Exemplo n.º 8
0
 public static bool ListContains(List<ManyDataTypesPoco> expectedEntities, ManyDataTypesPoco actualEntity)
 {
     foreach (var expectedEntity in expectedEntities)
     {
         try
         {
             expectedEntity.AssertEquals(actualEntity);
             return true;
         }
         catch (AssertionException) { }
     }
     return false;
 }