Exemplo n.º 1
0
        public async Task TestLinearTransformDecorator()
        {
            var component = new ValAggStub();

            var storage = new Stub2();

            var dec = new Microsoft.Research.Science.FetchClimate2.ValueAggregators.LinearTransformDecorator(storage, component);

            dec.SetAdditionalTranform("a", b => b * 3 + 7.0);

            FetchRequest fr = new FetchRequest("a", FetchDomain.CreatePoints(new double[] { 5.0 }, new double[] { -11.0 }, new TimeRegion()));

            IRequestContext rcs = RequestContextStub.GetStub(storage, fr);

            var res = await dec.AggregateCellsBatchAsync(new RequestStubs[] { new RequestStubs()
                                                                              {
                                                                                  LatMax = 5.0, LatMin = 5.0, LonMax = -11.0, LonMin = -11.0, Time = new TimeSegment(), VariableName = "a"
                                                                              } });

            Assert.AreEqual(253.0, res[0]);
        }
 public void ShouldNotHaveValuesForSpecificTypeOnly()
 {
     var stub = new Stub2();
     stub.Text.ShouldBe(null);
     Should.Throw<AssertionException>(() => stub.ShouldHaveValuesForAllProperties<Stub1>());
 }
 public void ShouldHaveValuesForSpecificTypeOnly()
 {
     var stub = new Stub2{Stub = new Stub1()};
     stub.Text.ShouldBe(null);
     stub.ShouldHaveValuesForAllProperties<Stub1>();
 }