コード例 #1
0
        public void GetRepository_Database()
        {
            IRepositoryFactory f = new RepositoryFactory(new Mocks.MockRepositoryConfigurationDatabase(cDBConnectionString));
            Assert.IsNotNull(f, "failed to create repo factory");

            IKPIRepository repo = f.GetRepository();
            Assert.IsNotNull(repo, "failed to get repository from factory");
            Assert.IsInstanceOf<DatabaseKPIRepository>(repo, "failed to get repository from factory");
        }
コード例 #2
0
        public void GetRepository_Random()
        {
            IRepositoryFactory f = new RepositoryFactory(new Mocks.MockRepositoryConfigurationMockRandom());
            Assert.IsNotNull(f, "failed to create repo factory");

            IKPIRepository repo = f.GetRepository();
            Assert.IsNotNull(repo, "failed to get repository from factory");
            Assert.IsInstanceOf<RandomKPIRepository>(repo, "failed to get repository from factory");
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string username = Request["userName"];
                string location = Request["location"];

                if (string.IsNullOrEmpty(location))
                {
                    location = "All";
                }

                if (!string.IsNullOrEmpty(username))
                {

                    IRepositoryConfiguration c = new RepositoryConfiguration();
                    IRepositoryFactory f = new RepositoryFactory(c);
                    IKPIDataService ds = new KPIDataService(f);

                    string json = ds.GetKPI(username, location);

                    //Response.ContentType = "text/json";
                    Response.Write(json);
                }
                else
                {
                    Response.StatusCode = 400;
                    Response.Write("Invalid username specified");
                }
            }
            catch (Exception ex)
            {
                Response.StatusCode = 500;
                Response.Write("{\"error\": \"" + ex.Message + "\"}");
            }
        }
コード例 #4
0
 public void Create()
 {
     IRepositoryFactory f = new RepositoryFactory(new Mocks.MockRepositoryConfigurationMockRandom());
     Assert.IsNotNull(f, "failed to create repo factory");
 }