예제 #1
0
 public static void IsTest(Action <bool, string> assertTrue)
 {
     AssemblyPropertyTestProgram.Execute(() =>
     {
         dotMemory.Check(memory =>
         {
             var objectSet = memory.GetObjects(_ => _.Assembly.Is(typeof(AssemblyPropertyTestProgram).Assembly));
             assertTrue(objectSet.ObjectsCount == AssemblyPropertyTestProgram.Local.Count + 1,
                        string.Format(AssertTemplates.AssertObjectsCountTemplate, AssemblyPropertyTestProgram.Local.Count + 1, objectSet.ObjectsCount));
             assertTrue(objectSet.SizeInBytes > 0, string.Format(AssertTemplates.AssertSizeInBytesTemplate, objectSet.SizeInBytes));
         });
     },
                                         () => { }
                                         );
 }
예제 #2
0
 public static void ArrayTest(Action <bool, string> assertTrue)
 {
     AssemblyPropertyTestProgram.Execute(() =>
     {
         var mscorlibAssembly = typeof(int).Assembly;
         dotMemory.Check(memory =>
         {
             var objectSet = memory.GetObjects(_ => _.Assembly.Is(typeof(AssemblyPropertyTestProgram.Local[]).Assembly) & _.Type.Is <AssemblyPropertyTestProgram.Local[]>());
             assertTrue(objectSet.ObjectsCount == 1,
                        string.Format(AssertTemplates.AssertObjectsCountTemplate, 1, objectSet.ObjectsCount));
             assertTrue(objectSet.SizeInBytes > 0, string.Format(AssertTemplates.AssertSizeInBytesTemplate, objectSet.SizeInBytes));
         });
     },
                                         () => { }
                                         );
 }
예제 #3
0
 public static void EmptyIntersectionTest(Action <bool, string> assertTrue)
 {
     AssemblyPropertyTestProgram.Execute(() =>
     {
         var mscorlibAssembly = typeof(int).Assembly;
         dotMemory.Check(memory =>
         {
             var objectSet = memory.GetObjects(_ => _.Assembly.Is(mscorlibAssembly) & _.Type.Is <AssemblyPropertyTestProgram.Local>());
             assertTrue(objectSet.ObjectsCount == 0,
                        string.Format(AssertTemplates.AssertObjectsCountTemplate, 0, objectSet.ObjectsCount));
             assertTrue(objectSet.SizeInBytes == 0, string.Format(AssertTemplates.AssertExactTotalSizeTemplate, 0, objectSet.SizeInBytes));
         });
     },
                                         () => { }
                                         );
 }
예제 #4
0
 public static void IsNotByExclusionTest(Action <bool, string> assertTrue)
 {
     AssemblyPropertyTestProgram.Execute(() =>
     {
         var mscorlibAssembly = typeof(int).Assembly;
         dotMemory.Check(memory =>
         {
             var isObjectSet    = memory.GetObjects(_ => _.Assembly.Is(mscorlibAssembly));
             var isNotObjectSet = memory.GetObjects(_ => _.Assembly.IsNot(mscorlibAssembly));
             assertTrue(isNotObjectSet.ObjectsCount == memory.ObjectsCount - isObjectSet.ObjectsCount,
                        string.Format(AssertTemplates.AssertObjectsCountTemplate, memory.ObjectsCount - isObjectSet.ObjectsCount, isNotObjectSet.ObjectsCount));
             assertTrue(isNotObjectSet.SizeInBytes == memory.SizeInBytes - isObjectSet.SizeInBytes,
                        string.Format(AssertTemplates.AssertExactTotalSizeTemplate, memory.SizeInBytes - isObjectSet.SizeInBytes, isNotObjectSet.SizeInBytes));
         });
     },
                                         () => { }
                                         );
 }
예제 #5
0
 public static void LikeTest(Action <bool, string> assertTrue)
 {
     AssemblyPropertyTestProgram.Execute(() =>
     {
         dotMemory.Check(memory =>
         {
             var patterns = GetLikePatterns();
             foreach (var pattern in patterns)
             {
                 Console.WriteLine(pattern);
                 var objectSet = memory.GetObjects(_ => _.Assembly.Like(pattern));
                 assertTrue(objectSet.ObjectsCount == AssemblyPropertyTestProgram.Local.Count + 1, // + 1 is Local[]
                            string.Format(AssertTemplates.AssertObjectsCountTemplate, AssemblyPropertyTestProgram.Local.Count + 1, objectSet.ObjectsCount));
                 assertTrue(objectSet.SizeInBytes > 0, string.Format(AssertTemplates.AssertSizeInBytesTemplate, objectSet.SizeInBytes));
             }
         });
     },
                                         () => { }
                                         );
 }