public void ManyToManyTest() { using (AdventureWorks adventureWorks = new AdventureWorks()) { Product[] products = adventureWorks .Products #if NETFX .Include(product => product.ProductProductPhotos.Select(productProductPhoto => productProductPhoto.ProductPhoto)) #else .Include(product => product.ProductProductPhotos).ThenInclude(productProductPhoto => productProductPhoto.ProductPhoto) #endif .ToArray(); EnumerableAssert.Multiple(products); EnumerableAssert.Any(products.Where(product => product.ProductProductPhotos.Any(productProductPhoto => productProductPhoto.ProductPhoto != null))); ProductPhoto[] photos = adventureWorks.ProductPhotos #if NETFX .Include(photo => photo.ProductProductPhotos.Select(productProductPhoto => productProductPhoto.Product)) #else .Include(photo => photo.ProductProductPhotos).ThenInclude(productProductPhoto => productProductPhoto.Product) #endif .ToArray(); EnumerableAssert.Multiple(photos); Assert.IsTrue(photos.All(photo => photo.ProductProductPhotos.Any(productProductPhoto => productProductPhoto.Product != null))); } }
public void QueryChildProcesses() { uint id = ProcessHelper.ByName("wininit.exe").Single().ProcessId.Value; IEnumerable <Win32Process> childProcesses = ProcessHelper.ChildProcesses(id); EnumerableAssert.Multiple(childProcesses); }
public void DotNetCategoryObjectsTest() { DotNetCategory category = new DotNetCategory(); Type[] types = category.Objects.ToArray(); EnumerableAssert.Multiple(types); }
public void QueryByNameTest() { IEnumerable <Win32Process> processes = ProcessHelper.ByName("System Idle Process"); EnumerableAssert.Single(processes); processes = ProcessHelper.ByName("svchost.exe"); EnumerableAssert.Multiple(processes); }
public void QueryAllParentProcesses() { Win32Process[] processes = ProcessHelper.ByName("svchost.exe").ToArray(); EnumerableAssert.Any(processes); processes.ForEach(process => { IEnumerable <Win32Process> parentProcesses = ProcessHelper.AllParentProcess(process.ProcessId.Value); EnumerableAssert.Multiple(parentProcesses); }); }
public void QueryAllChildProcesses() { uint id = ProcessHelper.ByName("wininit.exe").Single().ProcessId.Value; IEnumerable <Win32Process> tree = ProcessHelper.AllChildProcesses(id); EnumerableAssert.Multiple(tree); IEnumerable <Win32Process> childProcesses = ProcessHelper.ChildProcesses(id); Assert.IsTrue(tree.Count() > childProcesses.Count()); }
public void InheritanceTest() { using (AdventureWorks adventureWorks = new AdventureWorks()) { SalesTransactionHistory[] transactions = adventureWorks .SalesTransactions .Where(transaction => transaction.ActualCost > 0) .ToArray(); EnumerableAssert.Multiple(transactions); } }
public void ViewTest() { using (AdventureWorks adventureWorks = new AdventureWorks()) { IQueryable <vEmployee> employees1 = adventureWorks.vEmployees; EnumerableAssert.Multiple(employees1); IQueryable <vEmployee> employees2 = adventureWorks.vEmployees .Where(product => product.BusinessEntityID > 0 && !string.IsNullOrEmpty(product.JobTitle)); EnumerableAssert.Multiple(employees2); } }
public void OneToOneTest() { using (AdventureWorks adventureWorks = new AdventureWorks()) { Person[] people = adventureWorks .People .Include(person => person.Employee) .ToArray(); EnumerableAssert.Multiple(people); EnumerableAssert.Any(people.Where(person => person.Employee != null)); Employee[] employees = adventureWorks.Employees.Include(employee => employee.Person).ToArray(); EnumerableAssert.Multiple(employees); Assert.IsTrue(employees.All(employee => employee.Person != null)); } }
public void GetTypesWithVarianceTest() { IEnumerable <TypeDefinition> typesWithVariance = Variances.GetTypesWithVariance(); EnumerableAssert.Multiple(typesWithVariance); }
public void DotNetCategoryObjectsTest() { DotNetCategory category = new DotNetCategory(); EnumerableAssert.Multiple(category.Objects); }