public void Data_round_trip()
        {
            // insert test dataset
            var dataset = new Dataset
                {
                    Name = "SDKIntTest" + DateTime.Now.ToString("yyyyMMddHHmmssfffff"),
                    Horizon = 60,
                    Period = PeriodCodes.Week
                };

            _forecastingApi.InsertDataset(Identity, dataset);

            var timeseries = GetTimeSeries(100);

            var errorCode = _forecastingApi.UpsertTimeSeries(Identity, dataset.Name, timeseries, true);

            Assert.IsEmpty(errorCode);

            var client = new ForecastingClient(Identity, _forecastingApi);
            var data = client.ListTimeSeries(dataset.Name);
            var loaded = data.ToDictionary(s => s.Name);

            foreach (var exp in timeseries)
            {
                var actual = loaded[exp.Name];
                CollectionAssert.AreEquivalent(exp.Tags, actual.Tags, "Tags equal for {0}", exp.Name);

                CollectionAssert.AreEqual(exp.Values.Select(s => s.ToString()).ToArray(), actual.Values.Select(s => s.ToString()).ToArray(), "Values are equal");
                CollectionAssert.AreEqual(exp.Events.Select(s => s.ToString()).ToArray(), actual.Events.Select(s => s.ToString()).ToArray(), "Events are equal");

                Assert.AreEqual(exp.Tau, actual.Tau);
                Assert.AreEqual(exp.Lambda, actual.Lambda);
            }

            _forecastingApi.DeleteDataset(Identity, dataset.Name);
        }
        public void ListTimeSeries_IsForwarded()
        {
            string identity = "mockid", token = "mytoken", datasetName = "mydataset";
            IForecastingApi api;

            var mocks = new MockRepository();
            using (mocks.Record())
            {
                api = mocks.StrictMock<IForecastingApi>();

                Expect.Call(api.ListTimeSeries(identity, datasetName, null))
                    .Return(new TimeSerieCollection
                    {
                        TimeSeries = new TimeSerie[0],
                        ContinuationToken = token
                    });

                // 2nd call comes with continuation token
                Expect.Call(api.ListTimeSeries(identity, datasetName, token))
                    .Return(new TimeSerieCollection
                    {
                        TimeSeries = new TimeSerie[0],
                        ContinuationToken = null
                    });
            }

            using (mocks.Playback())
            {
                var client = new ForecastingClient(identity, api);
                var result = client.ListTimeSeries(datasetName);

                Assert.AreEqual(0, result.Count(), "#A00");
            }
        }