Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var widgetService = new WidgetService();

            WidgetGridView.DataSource = widgetService.GetWidgets();
            WidgetGridView.DataBind();
        }
Exemple #2
0
        public ActionResult Widgets()
        {
            ViewBag.SyncOrAsync = "Synchronous";
            var widgetService = new WidgetService();

            return(View("Widgets", widgetService.GetWidgets()));
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            var widgetService = new WidgetService();
            var prodService   = new ProductService();
            var gizmoService  = new GizmoService();

            var pwgVM = new ProdGizWidgetVM(
                widgetService.GetWidgets(),
                prodService.GetProducts(),
                gizmoService.GetGizmos()
                );

            WidgetGridView.DataSource = pwgVM.widgetList;
            WidgetGridView.DataBind();
            ProductGridView.DataSource = pwgVM.prodList;
            ProductGridView.DataBind();
            GizmoGridView.DataSource = pwgVM.gizmoList;
            GizmoGridView.DataBind();

            stopWatch.Stop();
            ElapsedTimeLabel.Text = String.Format("Elapsed time: {0}",
                                                  stopWatch.Elapsed.Milliseconds / 1000.0);
        }
Exemple #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var widgetService = new WidgetService();

            var widgetList = widgetService.GetWidgets();
            // ToDo, display Widgets
        }
Exemple #5
0
        public ActionResult PWG()
        {
            ViewBag.SyncType = "Synchronous";
            var widgetService = new WidgetService();
            var prodService   = new ProductService();
            var gizmoService  = new GizmoService();

            var pwgVM = new ProdGizWidgetVM(
                widgetService.GetWidgets(),
                prodService.GetProducts(),
                gizmoService.GetGizmos()
                );

            return(View("PWG", pwgVM));
        }
        public void ServiceShouldGetAllWidgets()
        {
            var widgets = new List <Dm.Widget>
            {
                new Dm.Widget
                {
                    Id = (int)System.DateTime.Now.Ticks
                }
            };

            var widgetRepository = new Mock <IRepository <Dm.Widget> >();

            widgetRepository.Setup(x => x.FindAll(y => y.Active, null)).Returns(widgets);

            var service = new WidgetService(widgetRepository.Object);

            var results = service.GetWidgets();

            widgetRepository.Verify(x => x.FindAll(y => y.Active, null), Times.Once);

            Assert.IsNotNull(results);
            Assert.AreEqual(widgets.Count, results.Count);
            Assert.AreEqual(widgets[0].Id, results[0].Id);
        }
Exemple #7
0
 public IEnumerable <WidgetResource> Get()
 {
     return(_widgetsService.GetWidgets());
 }