Example #1
0
        /// <summary>
        /// Create an instance of a typed child data portal using the context-specific DI container
        /// </summary>
        /// <typeparam name="T">The type which the child data portal is to service</typeparam>
        /// <param name="context">The context from which configuration can be retrieved</param>
        /// <returns>An instance of IChildDataPortal<typeparamref name="T"/> for use in data access during tests</returns>
        public static IChildDataPortal <T> CreateChildDataPortal <T>(TestDIContext context)
        {
            IChildDataPortal <T> dataPortal;

            dataPortal = context.ServiceProvider.GetRequiredService <IChildDataPortal <T> >();
            return(dataPortal);
        }
        /// <summary>
        /// Create an instance of ApplicationContext for use in testing, using a specific DI container
        /// </summary>
        /// <param name="context">The context from which configuration can be retrieved</param>
        /// <returns>An instance of ApplicationContext for use in testing of Csla</returns>
        public static ApplicationContext CreateTestApplicationContext(TestDIContext context)
        {
            ApplicationContext applicationContext;

            applicationContext = context.ServiceProvider.GetRequiredService <ApplicationContext>();
            return(applicationContext);
        }
Example #3
0
 /// <summary>
 /// Create a Child DataPortal instance for use in unit testing
 /// </summary>
 /// <param name="context">The context from which configuration can be retrieved</param>
 /// <returns>An instance of IChildDataPortal<typeparamref name="T"/> for use in testing</returns>
 public static IChildDataPortal <T> CreateChildDataPortal <T>(this TestDIContext context)
 {
     return(DataPortalFactory.CreateChildDataPortal <T>(context));
 }
Example #4
0
 /// <summary>
 /// Create an application context for use in unit testing
 /// </summary>
 /// <param name="context">The context from which configuration can be retrieved</param>
 /// <returns>An ApplicationContext constructed for use in testing</returns>
 public static ApplicationContext CreateTestApplicationContext(this TestDIContext context)
 {
     return(ApplicationContextFactory.CreateTestApplicationContext(context));
 }