public void GetTopFiveCountryName() { string startDate = DateTime.Now.Subtract(new TimeSpan(20, 0, 0, 0, 0)).ToShortDateString(); string endDate = DateTime.Now.ToShortDateString(); List <DashBoardSettingInfo> lstTopVisitedCountry = DashBoardController.GetTopFiveVisitedCountry(startDate, endDate); string CountryName; IPAddressToCountryResolver objIP = new IPAddressToCountryResolver(); List <string> topCountryArray = new List <string>(); int totalVisitors = 0; foreach (DashBoardSettingInfo obj in lstTopVisitedCountry) { objIP.GetCountry(obj.Country, out CountryName); if (CountryName == null) { obj.Country = obj.Country; } else { obj.Country = CountryName; } topCountryArray.Add(obj.Country); topCountryArray.Add(obj.VisitTime); totalVisitors += Int16.Parse(obj.VisitTime); } topCountry = string.Join(",", topCountryArray.ToArray()); ltrTotal.Text = "<label>Total Visitors: " + totalVisitors + "</label>"; }
public void Dashboard_TotalTweetCount_View_IsAvailable() { DashBoardController controller = CreateDashBoardControllerAs("*****@*****.**"); controller.ControllerContext = Helpers.GetMvcControllerContextMock(Helpers.GetHttpContextMock().Object).Object; var result = controller.OverAllTweets() as ActionResult; Assert.IsNotNull(result); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new DashBoardView()); DashBoardView view = new DashBoardView(); DashBoardController controller = new DashBoardController(view); view.ShowDialog(); }
public void GetSetting() { List <DashBoardSettingInfo> lstSetting = DashBoardController.ListDashBoardSettingForView(int.Parse(SageUserModuleID), GetPortalID); foreach (DashBoardSettingInfo objInfo in lstSetting) { StartDate = objInfo.StartDate; EndDate = objInfo.EndDate; } }
public void FilterCriteria_View_IsAvailable() { DashBoardController controller = CreateDashBoardControllerAs("*****@*****.**"); controller.ControllerContext = Helpers.GetMvcControllerContextMock(Helpers.GetHttpContextMock().Object).Object; var result = controller.FilterCriteria() as ViewResult; Assert.IsNotNull(result); }
public void Dashboard_FinalChart_View_IsAvailable() { DashBoardController controller = CreateDashBoardControllerAs("*****@*****.**"); controller.ControllerContext = Helpers.GetMvcControllerContextMock(Helpers.GetHttpContextMock().Object).Object; var result = controller.FinalGraph() as ActionResult; Assert.IsNotNull(result); }
public void Index() { // Arrange var controller = new DashBoardController(); // Act var result = controller.Index() as ViewResult; // Assert Assert.IsNotNull(result); }
public void SetUp() { var response = new DashBoardPackage { Metrics = TestData.CreateMetrics(), LatestAlbums = TestData.CreateAlbums() }; var mediator = MoqFactory.MockDashboardMediator(response); _dashBoardController = new DashBoardController(mediator.Object); RegisterForDispose(_dashBoardController); }
DashBoardController CreateDashBoardControllerAs(string userName) { var mock = new Mock <ControllerContext>(); mock.SetupGet(p => p.HttpContext.User.Identity.Name).Returns(userName); mock.SetupGet(p => p.HttpContext.Request.IsAuthenticated).Returns(true); var controller = new DashBoardController(); controller.ControllerContext = mock.Object; return(controller); }
private void LoadFilds() { using (DashBoardController ctr = new DashBoardController()) { ctr.LoadReport(date); report = ctr.report; btnOpenCalendar.Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(date.ToString("MMMM")); lbBalance.Text = report.TotalIncome.ToString("C"); lbExpense.Text = report.TotalExpenses.ToString("C"); lbRevenue.Text = report.TotalRevenue.ToString("C"); lbEconomy.Text = ctr.GetEconomy(date); ctr.GenerateChart(this.ctBank, ChartType.Account, date); ctr.GenerateChart(this.ctCategories, ChartType.Categories, date); ctr.GenerateChart(this.ctCreditCard, ChartType.CreditCard, date); } }
private void LoadSettings() { List <DashBoardSettingInfo> lstSetting = DashBoardController.GetDashBoardSetting(int.Parse(SageUserModuleID), GetPortalID); foreach (DashBoardSettingInfo obj in lstSetting) { switch (obj.SettingKey) { case "START_DATE": txtStartDate.Text = obj.SettingValue; break; case "END_DATE": txtEndDate.Text = obj.SettingValue; break; } } }
private void LoadFlowPanels() { FlpAccounts.Controls.Clear(); FlpCreditCard.Controls.Clear(); using (DashBoardController ctr = new DashBoardController()) { foreach (var button in ctr.GenerateCardsForFlp(PaymentMethodType.BankAccount)) { button.Click += new System.EventHandler(this.GerarRelatórioByButton_Click); FlpAccounts.Controls.Add(button); } foreach (var button in ctr.GenerateCardsForFlp(PaymentMethodType.CreditCard)) { button.Click += new System.EventHandler(this.GerarRelatórioByButton_Click); FlpCreditCard.Controls.Add(button); } } }
private void SaveSetting() { List <DashBoardSettingInfo> lstSetting = new List <DashBoardSettingInfo>(); lstSetting.Add(new DashBoardSettingInfo(DashBoardSetting.START_DATE.ToString(), txtStartDate.Text)); lstSetting.Add(new DashBoardSettingInfo(DashBoardSetting.END_DATE.ToString(), txtEndDate.Text)); lstSetting.ForEach( delegate(DashBoardSettingInfo obj) { obj.PortalID = GetPortalID; obj.UserModuleID = int.Parse(SageUserModuleID); obj.AddedBy = GetUsername; obj.IsActive = 1; } ); try { DashBoardController.AddDashBoardSetting(lstSetting); } catch (Exception ex) { ProcessException(ex); } }
protected void btnExportToExcel_Click(object sender, EventArgs e) { string table = ""; try { List <DashBoardSettingInfo> lstPages = DashBoardController.GetTopVisitedPage_Report(StartDate, EndDate); List <DashBoardSettingInfo> lstBrowser = DashBoardController.GetTopBrowser_Report(StartDate, EndDate); List <DashBoardSettingInfo> lstCountry = DashBoardController.GetTopVisitedCountry_Report(StartDate, EndDate); List <DashBoardSettingInfo> lstRefSite = DashBoardController.GetRefSite_Report(StartDate, EndDate); //Pages table += "<table><tr><th>Visited Page</th><th>Count</th></tr>"; foreach (DashBoardSettingInfo objInfo in lstPages) { table += " <tr>"; table += "<td>"; table += objInfo.VistPageWithoutExtension; table += "</td>"; table += "<td>"; table += objInfo.VisitTime; table += "</td>"; table += "</tr>"; } table += "</table>"; //Browser table += "<table><tr><th>Browser</th><th>Count</th></tr>"; foreach (DashBoardSettingInfo objBrowserInfo in lstBrowser) { table += " <tr>"; table += "<td>"; table += objBrowserInfo.Browser; table += "</td>"; table += "<td>"; table += objBrowserInfo.VisitTime; table += "</td>"; table += "</tr>"; } table += "</table>"; //Country table += "<table><tr><th>Country</th><th>Count</th></tr>"; foreach (DashBoardSettingInfo objCountryInfo in lstCountry) { string CountryName = string.Empty; objIP.GetCountry(objCountryInfo.SessionUserHostAddress, out CountryName); if (CountryName == string.Empty) { objCountryInfo.Country = objCountryInfo.SessionUserHostAddress; } else { objCountryInfo.Country = CountryName; } table += " <tr>"; table += "<td>"; table += objCountryInfo.Country; table += "</td>"; table += "<td>"; table += objCountryInfo.VisitTime; table += "</td>"; table += "</tr>"; } table += "</table>"; //Ref Sites table += "<table><tr><th>References Sites</th><th>Count</th></tr>"; foreach (DashBoardSettingInfo objRefInfo in lstRefSite) { table += " <tr>"; table += "<td>"; table += objRefInfo.RefPage; table += "</td>"; table += "<td>"; table += objRefInfo.VisitTime; table += "</td>"; table += "</tr>"; } table += "</table>"; ExportToExcel(ref table, "Analytic-Report"); } catch (Exception ex) { throw ex; } }
public void ExportToPDF() { List <DashBoardSettingInfo> lstPages = DashBoardController.GetTopVisitedPage_Report(StartDate, EndDate); List <DashBoardSettingInfo> lstBrowser = DashBoardController.GetTopBrowser_Report(StartDate, EndDate); List <DashBoardSettingInfo> lstCountry = DashBoardController.GetTopVisitedCountry_Report(StartDate, EndDate); List <DashBoardSettingInfo> lstRefSite = DashBoardController.GetRefSite_Report(StartDate, EndDate); HttpContext.Current.Response.ContentType = "application/pdf"; HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + "CountryVisitCount_" + DateTime.Now.ToString("M_dd_yyyy_H_M_s") + ".pdf"); Document doc = new Document(iTextSharp.text.PageSize.A4, 0, 0, 20, 20); PdfWriter writer = PdfWriter.GetInstance(doc, HttpContext.Current.Response.OutputStream); doc.Open(); var bodyFont = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, Font.NORMAL, new BaseColor(0, 0, 0)); var cellHeadingColor = new BaseColor(System.Drawing.ColorTranslator.FromHtml("#E3EDFA")); PdfPCell ClearCell = new PdfPCell(); ClearCell.Border = Rectangle.NO_BORDER; ClearCell.Colspan = 2; //Page PdfPTable tblPages; PdfPTable tblPage = new PdfPTable(2); tblPages = tblPage; var ReportHeaderFont = FontFactory.GetFont(FontFactory.COURIER_BOLD, 14, Font.NORMAL, new BaseColor(125, 88, 15)); PdfPCell AnalyticReport = new PdfPCell(); AnalyticReport.Colspan = 2; Paragraph AnalyticHeader = new Paragraph("Site Analytic Report", ReportHeaderFont); AnalyticReport.AddElement(AnalyticHeader); AnalyticHeader.Alignment = Element.ALIGN_CENTER; AnalyticReport.Border = Rectangle.NO_BORDER; tblPages.AddCell(AnalyticReport); tblPage.AddCell(ClearCell); var CellHeader = FontFactory.GetFont(FontFactory.COURIER_BOLD, 12, Font.NORMAL, new BaseColor(0, 0, 0)); var PageHeaderFont = FontFactory.GetFont(FontFactory.COURIER_BOLD, 12, Font.NORMAL, new BaseColor(80, 160, 191)); PdfPCell blankCell = new PdfPCell(); blankCell.Colspan = 2; Paragraph PageHeader = new Paragraph("Page wise visit", PageHeaderFont); blankCell.AddElement(PageHeader); blankCell.Border = Rectangle.NO_BORDER; tblPages.AddCell(blankCell); PdfPTable PageHeaderTbl = new PdfPTable(2); PageHeaderTbl.SetWidths(new int[2] { 10, 15 }); PageHeaderTbl.TotalWidth = doc.PageSize.Width; Paragraph headingPage = new Paragraph("Page", CellHeader); PdfPCell PageDateCell = new PdfPCell(headingPage); PageDateCell.HorizontalAlignment = Element.ALIGN_CENTER; tblPages.AddCell(PageDateCell); Paragraph HeadingPageCount = new Paragraph("Count", CellHeader); PdfPCell PageCount = new PdfPCell(HeadingPageCount); PageCount.HorizontalAlignment = Element.ALIGN_CENTER; tblPages.AddCell(PageCount); foreach (DashBoardSettingInfo objPageinfo in lstPages) { var PageCell = new PdfPCell(new Paragraph(objPageinfo.VistPageWithoutExtension, bodyFont)); PageCell.BackgroundColor = cellHeadingColor; PageCell.HorizontalAlignment = Element.ALIGN_CENTER; tblPages.AddCell(PageCell); var CountCell = new PdfPCell(new Paragraph(objPageinfo.VisitTime, bodyFont)); CountCell.BackgroundColor = cellHeadingColor; CountCell.HorizontalAlignment = Element.ALIGN_CENTER; tblPages.AddCell(CountCell); } tblPage.AddCell(ClearCell); tblPage.AddCell(ClearCell); doc.Add(tblPages); //Browser wise visit PdfPTable tblBrowsers; PdfPTable tblBrowser = new PdfPTable(2); tblBrowsers = tblBrowser; var BrowserBodyFont = FontFactory.GetFont(FontFactory.COURIER_BOLD, 12, Font.NORMAL, new BaseColor(80, 160, 191)); PdfPCell BrowserblankCell = new PdfPCell(); BrowserblankCell.Colspan = 2; Paragraph HeadingBrowser = new Paragraph("Browser wise visit", BrowserBodyFont); BrowserblankCell.AddElement(HeadingBrowser); BrowserblankCell.Border = Rectangle.NO_BORDER; tblBrowsers.AddCell(BrowserblankCell); PdfPTable BrowserHeaderTbl = new PdfPTable(2); PageHeaderTbl.SetWidths(new int[2] { 10, 15 }); PageHeaderTbl.TotalWidth = doc.PageSize.Width; Paragraph headingPara = new Paragraph("Browser", CellHeader); PdfPCell BrowserHeading = new PdfPCell(headingPara); BrowserHeading.HorizontalAlignment = Element.ALIGN_CENTER; BrowserHeading.PaddingLeft = 15f; tblBrowsers.AddCell(BrowserHeading); Paragraph BrowserCount = new Paragraph("Count", CellHeader); PdfPCell BCount = new PdfPCell(BrowserCount); BCount.HorizontalAlignment = Element.ALIGN_CENTER; BCount.PaddingLeft = 50f; tblBrowsers.AddCell(BCount); foreach (DashBoardSettingInfo objBrowserinfo in lstBrowser) { var BrowserCell = new PdfPCell(new Paragraph(objBrowserinfo.Browser, bodyFont)); BrowserCell.BackgroundColor = cellHeadingColor; BrowserCell.HorizontalAlignment = Element.ALIGN_CENTER; tblBrowsers.AddCell(BrowserCell); var BrowserCountCell = new PdfPCell(new Paragraph(objBrowserinfo.VisitTime, bodyFont)); BrowserCountCell.HorizontalAlignment = Element.ALIGN_CENTER; BrowserCountCell.BackgroundColor = cellHeadingColor; tblBrowsers.AddCell(BrowserCountCell); } tblBrowsers.AddCell(ClearCell); tblBrowsers.AddCell(ClearCell); doc.Add(tblBrowsers); //Country PdfPTable tblCountrys; PdfPTable tblCountry = new PdfPTable(2); tblCountrys = tblCountry; var CountryBodyFont = FontFactory.GetFont(FontFactory.COURIER_BOLD, 12, Font.NORMAL, new BaseColor(80, 160, 191)); PdfPCell CountryblankCell = new PdfPCell(); CountryblankCell.Colspan = 2; Paragraph HeadingCountry = new Paragraph("Country wise visit", CountryBodyFont); CountryblankCell.AddElement(HeadingCountry); CountryblankCell.Border = Rectangle.NO_BORDER; tblCountrys.AddCell(CountryblankCell); PdfPTable CountryHeaderTbl = new PdfPTable(2); PageHeaderTbl.SetWidths(new int[2] { 10, 15 }); PageHeaderTbl.TotalWidth = doc.PageSize.Width; Paragraph CountryPara = new Paragraph("Country", CellHeader); PdfPCell CountryHeading = new PdfPCell(CountryPara); CountryHeading.HorizontalAlignment = Element.ALIGN_CENTER; tblCountrys.AddCell(CountryHeading); Paragraph CountryCount = new Paragraph("Count", CellHeader); PdfPCell CCount = new PdfPCell(CountryCount); CCount.HorizontalAlignment = Element.ALIGN_CENTER; tblCountrys.AddCell(CCount); foreach (DashBoardSettingInfo objCountryInfo in lstCountry) { string CountryName = string.Empty; objIP.GetCountry(objCountryInfo.SessionUserHostAddress, out CountryName); if (CountryName == string.Empty) { objCountryInfo.Country = objCountryInfo.SessionUserHostAddress; } else { objCountryInfo.Country = CountryName; } var CountryCell = new PdfPCell(new Paragraph(objCountryInfo.Country, bodyFont)); CountryCell.BackgroundColor = cellHeadingColor; CountryCell.HorizontalAlignment = Element.ALIGN_CENTER; tblCountrys.AddCell(CountryCell); var CountryVisitCell = new PdfPCell(new Paragraph(objCountryInfo.VisitTime, bodyFont)); CountryVisitCell.HorizontalAlignment = Element.ALIGN_CENTER; CountryVisitCell.BackgroundColor = cellHeadingColor; tblCountrys.AddCell(CountryVisitCell); } tblCountrys.AddCell(ClearCell); tblCountrys.AddCell(ClearCell); doc.Add(tblCountrys); //References Sites PdfPTable tblRefSites; PdfPTable tblRefSite = new PdfPTable(2); tblRefSites = tblRefSite; var RefBodyFont = FontFactory.GetFont(FontFactory.COURIER_BOLD, 12, Font.NORMAL, new BaseColor(80, 160, 191)); PdfPCell RefblankCell = new PdfPCell(); RefblankCell.Colspan = 2; Paragraph HeadingRef = new Paragraph("Reference pages", RefBodyFont); RefblankCell.AddElement(HeadingRef); RefblankCell.Border = Rectangle.NO_BORDER; tblRefSites.AddCell(RefblankCell); PdfPTable RefHeaderTbl = new PdfPTable(2); PageHeaderTbl.SetWidths(new int[2] { 10, 15 }); PageHeaderTbl.TotalWidth = doc.PageSize.Width; Paragraph RefPara = new Paragraph("Reference pages", CellHeader); PdfPCell RefHeading = new PdfPCell(RefPara); RefHeading.HorizontalAlignment = Element.ALIGN_CENTER; tblRefSites.AddCell(RefHeading); Paragraph RefCount = new Paragraph("Count", CellHeader); PdfPCell RefParaCount = new PdfPCell(RefCount); RefParaCount.HorizontalAlignment = Element.ALIGN_CENTER; tblRefSites.AddCell(RefParaCount); foreach (DashBoardSettingInfo objRefInfo in lstRefSite) { var RefCell = new PdfPCell(new Paragraph(objRefInfo.RefPage, bodyFont)); RefCell.HorizontalAlignment = Element.ALIGN_CENTER; RefCell.BackgroundColor = cellHeadingColor; RefCell.HorizontalAlignment = Element.ALIGN_CENTER; tblRefSites.AddCell(RefCell); var RefVisitCell = new PdfPCell(new Paragraph(objRefInfo.VisitTime, bodyFont)); RefVisitCell.HorizontalAlignment = Element.ALIGN_CENTER; RefVisitCell.BackgroundColor = cellHeadingColor; tblRefSites.AddCell(RefVisitCell); } tblRefSites.AddCell(ClearCell); tblRefSites.AddCell(ClearCell); doc.Add(tblRefSites); doc.Close(); }
public void SetController(DashBoardController _controller) { controller = _controller; }
public void Init() { #region Dummy Lists var passwordSalt1 = PasswordUtilities.CreateSalt(16); var password1 = PasswordUtilities.GenerateSHA256Hash("12345", passwordSalt1); clients = new List <Client> { new Client { ClientID = 1, FirstName = "John", LastName = "Doe", DocType = "DNI", DocNumber = 34578800, BirthDate = new DateTime(1990, 12, 31), DateFrom = new DateTime(2008, 09, 01), Email = "*****@*****.**", Password = password1, PasswordSalt = passwordSalt1, Role = Catalog.Roles.Client, Sexo = Catalog.Genre.Hombre }, new Client { ClientID = 2, FirstName = "Cristian", LastName = "Piqué", DocType = "DNI", DocNumber = 34578644, BirthDate = new DateTime(1989, 12, 31), DateFrom = new DateTime(2008, 09, 01), Email = "*****@*****.**", Password = password1, PasswordSalt = passwordSalt1, Role = Catalog.Roles.Admin, Sexo = Catalog.Genre.Hombre }, new Client { ClientID = 3, FirstName = "José", LastName = "Pérez", DocType = "DNI", DocNumber = 34578644, BirthDate = new DateTime(1982, 12, 31), DateFrom = new DateTime(2014, 09, 01), Email = "*****@*****.**", Password = password1, PasswordSalt = passwordSalt1, Role = Catalog.Roles.Instructor, Sexo = Catalog.Genre.Hombre }, new Client { ClientID = 4, FirstName = "Ray", LastName = "Allen", DocType = "DNI", DocNumber = 34578644, BirthDate = new DateTime(1992, 12, 31), DateFrom = new DateTime(2014, 09, 01), Email = "*****@*****.**", Password = password1, PasswordSalt = passwordSalt1, Role = Catalog.Roles.Client, Sexo = Catalog.Genre.Hombre }, new Client { ClientID = 5, FirstName = "Enzo", LastName = "Gutiérrez", DocType = "DNI", DocNumber = 34578644, BirthDate = new DateTime(1991, 12, 31), DateFrom = new DateTime(2014, 09, 01), Email = "*****@*****.**", Password = password1, PasswordSalt = passwordSalt1, Role = Catalog.Roles.Client, Sexo = Catalog.Genre.Hombre }, new Client { ClientID = 6, FirstName = "Juana", LastName = "Pérez", DocType = "DNI", DocNumber = 33123654, BirthDate = new DateTime(1979, 08, 11), DateFrom = new DateTime(2015, 09, 01), Email = "*****@*****.**", Password = password1, PasswordSalt = passwordSalt1, Role = Catalog.Roles.Client, Sexo = Catalog.Genre.Mujer }, new Client { ClientID = 7, FirstName = "Carolina", LastName = "García", DocType = "DNI", DocNumber = 12345678, BirthDate = new DateTime(1971, 11, 15), DateFrom = new DateTime(2015, 09, 01), Email = "*****@*****.**", Password = password1, PasswordSalt = passwordSalt1, Role = Catalog.Roles.Instructor, Sexo = Catalog.Genre.Mujer }, new Client { ClientID = 8, FirstName = "Martina", LastName = "Núñez", DocType = "DNI", DocNumber = 34578644, BirthDate = new DateTime(1981, 02, 01), DateFrom = new DateTime(2015, 09, 01), Email = "*****@*****.**", Password = password1, PasswordSalt = passwordSalt1, Role = Catalog.Roles.Client, Sexo = Catalog.Genre.Mujer }, new Client { ClientID = 9, FirstName = "Sol", LastName = "Rodríguez", DocType = "DNI", DocNumber = 34578644, BirthDate = new DateTime(1991, 12, 31), DateFrom = new DateTime(2015, 09, 01), Email = "*****@*****.**", Password = password1, PasswordSalt = passwordSalt1, Role = Catalog.Roles.Client, Sexo = Catalog.Genre.Mujer }, new Client { ClientID = 10, FirstName = "José", LastName = "García", DocType = "DNI", DocNumber = 34578644, BirthDate = new DateTime(1986, 12, 31), DateFrom = new DateTime(2016, 09, 01), Email = "*****@*****.**", Password = password1, PasswordSalt = passwordSalt1, Role = Catalog.Roles.Client, Sexo = Catalog.Genre.Hombre } }; medicalRecords = new List <MedicalRecord> { new MedicalRecord { ClientID = 1, Age = 26, Gender = 'M', Heigth = 1.81, Weight = 77 }, new MedicalRecord { ClientID = 2, Age = 33, Gender = 'F', Heigth = 1.81, Weight = 75 }, new MedicalRecord { ClientID = 3, Age = 28, Gender = 'F', Heigth = 1.81, Weight = 75 }, new MedicalRecord { ClientID = 4, Age = 23, Gender = 'M', Heigth = 1.81, Weight = 79 }, new MedicalRecord { ClientID = 5, Age = 26, Gender = 'M', Heigth = 1.81, Weight = 75 }, new MedicalRecord { ClientID = 6, Age = 26, Gender = 'F', Heigth = 1.81, Weight = 75 }, new MedicalRecord { ClientID = 7, Age = 25, Gender = 'M', Heigth = 1.81, Weight = 88 }, new MedicalRecord { ClientID = 8, Age = 26, Gender = 'M', Heigth = 1.81, Weight = 75 }, new MedicalRecord { ClientID = 10, Age = 18, Gender = 'M', Heigth = 1.81, Weight = 75 }, new MedicalRecord { ClientID = 4, Age = 26, Gender = 'M', Heigth = 1.81, Weight = 75 }, }; #endregion #region Repositories clientRepository = Mock.Create <IClientRepository>(); medicalRecordRepository = Mock.Create <IMedicalRecordRepository>(); context = Mock.Create <HttpContextBase>(); request = Mock.Create <HttpRequestBase>(); response = Mock.Create <HttpResponseBase>(); session = Mock.Create <HttpSessionStateBase>(); server = Mock.Create <HttpServerUtilityBase>(); #endregion #region Controller controller = new DashBoardController(clientRepository, medicalRecordRepository); #endregion #region Fake Context Mock.Arrange(() => clientRepository .GetClientByID(CLIENT_ID_TO_USE)) .Returns(clients.Where(c => c.ClientID == CLIENT_ID_TO_USE) .FirstOrDefault()); Mock.Arrange(() => context.Request).Returns(request); Mock.Arrange(() => context.Response).Returns(response); Mock.Arrange(() => context.Session).Returns(session); Mock.Arrange(() => context.Server).Returns(server); Mock.Arrange(() => session["UserData"]).Returns(clients.Where(c => c.ClientID == CLIENT_ID_TO_USE)); #endregion #region JustMock #endregion }