public static void ThrowsArgumentExceptionOnNonExistingPathImpl() { using (TestWebContext ctx = new TestWebContext("/Test", "testform.aspx")) { WebObjectDefinitionFactory factory = new WebObjectDefinitionFactory(); IWebObjectDefinition definition = (IWebObjectDefinition)factory.CreateObjectDefinition("/Test/DoesNotExist.aspx", "parentdefinition", AppDomain.CurrentDomain); } }
public static void ResolvesToPageRootDefinitionIfEndsWithASPXImpl() { using (TestWebContext ctx = new TestWebContext("/Test", "testform.aspx")) { WebObjectDefinitionFactory factory = new WebObjectDefinitionFactory(); IWebObjectDefinition definition = (IWebObjectDefinition)factory.CreateObjectDefinition("/Test/testform.aspx", null, AppDomain.CurrentDomain); Assert.IsNotNull(definition, "CreateObjectDefinition with no parent is returning null (it must never do so)."); Assert.IsTrue(definition.IsPage, ".aspx extension must result in a page instance"); Assert.AreEqual(typeof(RootWebObjectDefinition), definition.GetType()); } }
public static void BCLPageHandlerFactoryBehaviorImpl() { using (TestWebContext ctx = new TestWebContext("/Test", "DoesNotExist.oaspx")) { try { IHttpHandlerFactory phf = (IHttpHandlerFactory)Activator.CreateInstance(typeof(System.Web.UI.Page).Assembly.GetType("System.Web.UI.PageHandlerFactory"), true); phf.GetHandler(HttpContext.Current, "GET", ctx.HttpWorkerRequest.GetFilePath(), ctx.HttpWorkerRequest.GetFilePathTranslated()); } catch (HttpException e) { Assert.AreEqual(404, e.GetHttpCode()); Assert.IsTrue(e.Message.IndexOf(ctx.HttpWorkerRequest.GetFilePath()) > 0); } } }
public static void PageHandlerFactoryBehavesLikeSystemPageHandlerFactoryImpl() { using (TestWebContext ctx = new TestWebContext("/Test", "DoesNotExist.aspx")) { try { IHttpHandlerFactory phf = new PageHandlerFactory(); phf.GetHandler(HttpContext.Current, "GET", ctx.HttpWorkerRequest.GetFilePath(), ctx.HttpWorkerRequest.GetFilePathTranslated()); } catch (HttpException e) { Assert.AreEqual(404, e.GetHttpCode()); Assert.IsTrue(e.Message.IndexOf(ctx.HttpWorkerRequest.GetFilePath()) > 0); } } }
public void RunTestWithDI() { // LogManager.Adapter = new Common.Logging.Simple.TraceLoggerFactoryAdapter(); DataView dv = CreateDataSource(); using (TestWebContext wctx = new TestWebContext("/testpath", "testpage.aspx")) { IApplicationContext ctx = new WebApplicationContext(); int runs = 1000; StopWatch watch = new StopWatch(); using (watch.Start("Duration: {0}")) { for (int i = 0; i < runs; i++) { DataGrid grid = new DataGrid(); Spring.Web.Support.WebDependencyInjectionUtils.InjectDependenciesRecursive(ctx, grid); grid.DataSource = dv; grid.DataBind(); } } using (watch.Start("Duration: {0}")) { for (int i = 0; i < runs; i++) { DataGrid grid = new DataGrid(); grid.DataSource = dv; grid.DataBind(); Spring.Web.Support.WebDependencyInjectionUtils.InjectDependenciesRecursive(ctx, grid); } } } }
public ProveedorController(TestWebContext context) { proveedorService = new ProveedorService(context); }
public LoginController(TestWebContext context) { usuarioService = new UsuarioService(context); }
public InteresadoController(TestWebContext context) { interesadoService = new InteresadoService(context); }
public ProductoService(TestWebContext testWebContext) { this.testWebContext = testWebContext; }
public DetalleController(TestWebContext context) { detalleService = new DetalleService(context); }
public FacturaService(TestWebContext testWebContext) { this.testWebContext = testWebContext; detalleService = new DetalleService(testWebContext); }
public ProveedorService(TestWebContext testWebContext) { this.testWebContext = testWebContext; }
public FacturaController(TestWebContext context) { facturaService = new FacturaService(context); }
public DetalleService(TestWebContext testWebContext) { this.testWebContext = testWebContext; productoService = new ProductoService(testWebContext); }
public ProductoController(TestWebContext context) { productoService = new ProductoService(context); }
public InteresadoService(TestWebContext testWebContext) { this.testWebContext = testWebContext; }
public UsuarioService(TestWebContext testWebContext) { this.testWebContext = testWebContext; }