Example #1
0
 public void AssertEquals(NestedCollectionsPoco poco)
 {
     Assert.AreEqual(StringType, poco.StringType);
     Assert.AreEqual(GuidType, poco.GuidType);
     CollectionAssert.AreEqual(NestedDictionaryDictionary, poco.NestedDictionaryDictionary);
     CollectionAssert.AreEqual(NestedListDictionary, poco.NestedListDictionary);
     CollectionAssert.AreEqual(NestedSortedListDictionary, poco.NestedSortedListDictionary);
 }
 public void AssertEquals(NestedCollectionsPoco poco)
 {
     Assert.AreEqual(StringType, poco.StringType);
     Assert.AreEqual(GuidType, poco.GuidType);
     CollectionAssert.AreEqual(NestedDictionaryDictionary, poco.NestedDictionaryDictionary);
     CollectionAssert.AreEqual(NestedListDictionary, poco.NestedListDictionary);
     CollectionAssert.AreEqual(NestedSortedListDictionary, poco.NestedSortedListDictionary);
 }
Example #3
0
        public static NestedCollectionsPoco GetRandomInstance()
        {
            Dictionary <string, Dictionary <string, long> > nestedDictionaryDictionary = new Dictionary <string, Dictionary <string, long> >();

            nestedDictionaryDictionary.Add(Randomm.RandomAlphaNum(10), new Dictionary <string, long>()
            {
                { Randomm.RandomAlphaNum(10), 123456789L }
            });
            List <Dictionary <string, string> > nestedListDictionary = new List <Dictionary <string, string> >();

            nestedListDictionary.Add(new Dictionary <string, string>()
            {
                { Randomm.RandomAlphaNum(10), Randomm.RandomAlphaNum(10) }, { Randomm.RandomAlphaNum(10), Randomm.RandomAlphaNum(10) }
            });
            nestedListDictionary.Add(new Dictionary <string, string>()
            {
                { Randomm.RandomAlphaNum(10), Randomm.RandomAlphaNum(10) }, { Randomm.RandomAlphaNum(10), Randomm.RandomAlphaNum(10) }
            });
            SortedList <string, Dictionary <string, DateTime> > nestedSortedListDictionary = new SortedList <string, Dictionary <string, DateTime> >();

            nestedSortedListDictionary.Add("abc", new Dictionary <string, DateTime>()
            {
                { Randomm.RandomAlphaNum(10), DateTime.Now.AddDays(1) }
            });
            nestedSortedListDictionary.Add("zyz", new Dictionary <string, DateTime>()
            {
                { Randomm.RandomAlphaNum(10), DateTime.Now.AddHours(900) }
            });
            nestedSortedListDictionary.Add("def", new Dictionary <string, DateTime>()
            {
                { Randomm.RandomAlphaNum(10), DateTime.Now.AddHours(1) }
            });

            NestedCollectionsPoco randomInstance = new NestedCollectionsPoco
            {
                StringType = "StringType_val_" + Randomm.RandomAlphaNum(10),
                GuidType   = Guid.NewGuid(),
                NestedDictionaryDictionary = nestedDictionaryDictionary,
                NestedListDictionary       = nestedListDictionary,
                NestedSortedListDictionary = nestedSortedListDictionary,
            };

            return(randomInstance);
        }
        public static NestedCollectionsPoco GetRandomInstance()
        {
            Dictionary<string, Dictionary<string, long>> nestedDictionaryDictionary = new Dictionary<string, Dictionary<string, long>>();
            nestedDictionaryDictionary.Add(Randomm.RandomAlphaNum(10), new Dictionary<string, long>() { { Randomm.RandomAlphaNum(10), 123456789L } });
            List<Dictionary<string, string>> nestedListDictionary = new List<Dictionary<string, string>>();
            nestedListDictionary.Add(new Dictionary<string, string>() { { Randomm.RandomAlphaNum(10), Randomm.RandomAlphaNum(10) }, { Randomm.RandomAlphaNum(10), Randomm.RandomAlphaNum(10) } });
            nestedListDictionary.Add(new Dictionary<string, string>() { { Randomm.RandomAlphaNum(10), Randomm.RandomAlphaNum(10) }, { Randomm.RandomAlphaNum(10), Randomm.RandomAlphaNum(10) } });
            SortedList<string, Dictionary<string, DateTime>> nestedSortedListDictionary = new SortedList<string, Dictionary<string, DateTime>>();
            nestedSortedListDictionary.Add("abc", new Dictionary<string, DateTime>() { { Randomm.RandomAlphaNum(10), DateTime.Now.AddDays(1) } });
            nestedSortedListDictionary.Add("zyz", new Dictionary<string, DateTime>() { { Randomm.RandomAlphaNum(10), DateTime.Now.AddHours(900) } });
            nestedSortedListDictionary.Add("def", new Dictionary<string, DateTime>() { { Randomm.RandomAlphaNum(10), DateTime.Now.AddHours(1) } });

            NestedCollectionsPoco randomInstance = new NestedCollectionsPoco
            {
                StringType = "StringType_val_" + Randomm.RandomAlphaNum(10),
                GuidType = Guid.NewGuid(),
                NestedDictionaryDictionary = nestedDictionaryDictionary,
                NestedListDictionary = nestedListDictionary,
                NestedSortedListDictionary = nestedSortedListDictionary,
            };
            return randomInstance;
        }
Example #5
0
 public static void AssertListContains(List <NestedCollectionsPoco> expectedEntities, NestedCollectionsPoco actualEntity)
 {
     Assert.IsTrue(ListContains(expectedEntities, actualEntity));
 }
Example #6
0
 public static bool ListContains(List <NestedCollectionsPoco> expectedEntities, NestedCollectionsPoco actualEntity)
 {
     foreach (var expectedEntity in expectedEntities)
     {
         try
         {
             expectedEntity.AssertEquals(actualEntity);
             return(true);
         }
         catch (AssertionException) { }
     }
     return(false);
 }
 public static void AssertListContains(List<NestedCollectionsPoco> expectedEntities, NestedCollectionsPoco actualEntity)
 {
     Assert.IsTrue(ListContains(expectedEntities, actualEntity));
 }
 public static bool ListContains(List<NestedCollectionsPoco> expectedEntities, NestedCollectionsPoco actualEntity)
 {
     foreach (var expectedEntity in expectedEntities)
     {
         try
         {
             expectedEntity.AssertEquals(actualEntity);
             return true;
         }
         catch (AssertionException) { }
     }
     return false;
 }