Example #1
0
        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 ParameterFacade(_context);

            ODataHelper oDataHelper = new ODataHelper();

            _controller         = new ParametersController(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);
        }
Example #2
0
 public void TearDown()
 {
     _facade = null;
     _controller.Dispose();
     _context.Dispose();
 }