public void TestAnalyticsModel()
        {
            RequestSettings settings = new RequestSettings("Unittests", this.userName, this.passWord);

            AnalyticsRequest request = new AnalyticsRequest(settings);

            Feed <Account> accounts = request.GetAccounts();

            foreach (Account a in accounts.Entries)
            {
                Assert.IsNotNull(a.AccountId);
                Assert.IsNotNull(a.ProfileId);
                Assert.IsNotNull(a.WebPropertyId);
                if (this.accountId == null)
                {
                    this.accountId = a.TableId;
                }
            }


            DataQuery q = new DataQuery(this.accountId, DateTime.Now.AddDays(-14), DateTime.Now.AddDays(-2), "ga:pageviews", "ga:pageTitle", "ga:pageviews");


            Dataset set = request.Get(q);

            foreach (Data d in set.Entries)
            {
                Assert.IsNotNull(d.Id);
                Assert.IsNotNull(d.Metrics);
                Assert.IsNotNull(d.Dimensions);
            }
        }
Ejemplo n.º 2
0
        public void TestAnalyticsModel()
        {
            RequestSettings settings = new RequestSettings("Unittests", this.userName, this.passWord);

            AnalyticsRequest request = new AnalyticsRequest(settings);

            Feed<Account> accounts = request.GetAccounts();

            foreach (Account a in accounts.Entries)
            {
                Assert.IsNotNull(a.AccountId);
                Assert.IsNotNull(a.ProfileId);
                Assert.IsNotNull(a.WebPropertyId);
                if (this.accountId == null)
                    this.accountId = a.TableId;
            }
            

            DataQuery q = new DataQuery(this.accountId, DateTime.Now.AddDays(-14), DateTime.Now.AddDays(-2), "ga:pageviews", "ga:pageTitle", "ga:pageviews");


            Dataset set = request.Get(q);

            foreach (Data d in set.Entries)
            {
                Assert.IsNotNull(d.Id);
                Assert.IsNotNull(d.Metrics);
                Assert.IsNotNull(d.Dimensions);
            }
        }