public void Setup() { var claim = new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", _userId.ToString()); Thread.CurrentPrincipal = new ClaimsPrincipal(new ClaimsIdentity(new List <Claim> { claim })); var connectionString = ConfigurationManager.ConnectionStrings["DataContext"].ConnectionString; _context = new DataContext(connectionString); _facade = new DashboardFacade(_context, new DashboardValidator()); ODataHelper oDataHelper = new ODataHelper(); _controller = new DashboardsController(oDataHelper, _facade); _controller.Request = new HttpRequestMessage(); _controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration()); // Setting the URI of the request here is needed for the API POST method to work _controller.Request.RequestUri = new Uri("http://tempuri.com"); /* * TODO: akrone - Taking on some Techincal Debt doing this, but pulling the Seeder into it's own project would need to * be merged into other development work going on for sprint 60 */ Seeder.SeedWithTestData(_context); }
public void Setup() { _mockContext = SetupMockDbContext(); _tnt01user = _mockContext.Object.Users.Single(u => u.UserName == "tnt01user"); _tnt02user = _mockContext.Object.Users.Single(u => u.UserName == "tnt02user"); _tnt01and02user = _mockContext.Object.Users.Single(u => u.UserName == "tnt01and02user"); _adHachUser = _mockContext.Object.Users.Single(u => u.UserName == "adhach"); var claim = new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", _tnt01user.Id.ToString()); Thread.CurrentPrincipal = new ClaimsPrincipal(new ClaimsIdentity(new List <Claim> { claim })); var validator = new DashboardValidator(); _facade = new DashboardFacade(_mockContext.Object, validator); }
public void getMPOCR() { string modelCode = String.Empty; string itemCode = String.Empty; string orderCode = String.Empty; string frmDate = String.Empty; string toDate = String.Empty; string frmMonth = String.Empty; string toMonth = String.Empty; string frmWeek = String.Empty; string toWeek = String.Empty; string statisticlatitude = String.Empty; if (this.Request.QueryString["modelcode"] != null) { modelCode = this.Request.QueryString["modelcode"]; } if (this.Request.QueryString["itemcode"] != null) { itemCode = this.Request.QueryString["itemcode"]; } if (this.Request.QueryString["ordercode"] != null) { orderCode = this.Request.QueryString["ordercode"]; } if (this.Request.QueryString["fromdate"] != null) { frmDate = this.Request.QueryString["fromdate"]; } if (this.Request.QueryString["todate"] != null) { toDate = this.Request.QueryString["todate"]; } if (this.Request.QueryString["frommonth"] != null) { frmMonth = this.Request.QueryString["frommonth"]; } if (this.Request.QueryString["tomonth"] != null) { toMonth = this.Request.QueryString["tomonth"]; } if (this.Request.QueryString["fromweek"] != null) { frmWeek = this.Request.QueryString["fromweek"]; } if (this.Request.QueryString["toweek"] != null) { toWeek = this.Request.QueryString["toweek"]; } if (this.Request.QueryString["statisticlatitude"] != null) { statisticlatitude = this.Request.QueryString["statisticlatitude"]; } if (dbFAC == null) { dbFAC = (new FacadeFactory()).CreateDashboardFacade();; } string xmlContent = dbFAC.getMPOCR( modelCode , itemCode , orderCode , frmDate , toDate , frmMonth , toMonth , frmWeek , toWeek , statisticlatitude); this.Response.Clear(); this.Response.ClearContent(); this.Response.ClearHeaders(); this.Response.Write(xmlContent); }
public void TearDown() { _facade = null; _controller.Dispose(); _context.Dispose(); }