public void AddChangePoint_Multiple()
        {
            var attributeData        = new AttributeData(null);
            var temporalValueItemOne = new TemporalValueItem(new DateTime(2017, 1, 1), null, null);
            var temporalValueItemTwo = new TemporalValueItem(new DateTime(2017, 1, 1), null, null);

            attributeData.AddChangepoint(temporalValueItemOne);
            attributeData.AddChangepoint(temporalValueItemTwo);

            attributeData.Changepoints.Should().HaveCount(2);
            attributeData.Changepoints.Should().Contain(temporalValueItemOne);
            attributeData.Changepoints.Should().Contain(temporalValueItemTwo);
        }
        public void IsTemporal_True_NullValueOneCP()
        {
            IAttributeData attributeDataIsTemporalTrue = new AttributeData(null);

            attributeDataIsTemporalTrue.AddChangepoint(new TemporalValueItem(new DateTime(2017, 1, 1), null, null));

            attributeDataIsTemporalTrue.IsTemporal.Should().BeTrue();
        }
        public void IsTemporal_False_ValueAndCP()
        {
            IAttributeData attributeData = new AttributeData("Not Null");

            attributeData.AddChangepoint(new TemporalValueItem(new DateTime(2017, 1, 1), null, null));

            attributeData.IsTemporal.Should().BeFalse();
        }
        public void AddChangePoint()
        {
            var attributeData     = new AttributeData(null);
            var temporalValueItem = new TemporalValueItem(new DateTime(2017, 1, 1), null, null);

            attributeData.AddChangepoint(temporalValueItem);

            attributeData.Changepoints.Should().HaveCount(1);
            attributeData.Changepoints.Should().Contain(temporalValueItem);
        }
Ejemplo n.º 5
0
        protected internal IAttributeData MapOpaAttributeToDataEntity(EntityInstance entityInstance, RBAttr attr)
        {
            var value = attr.GetValue(entityInstance);

            if (value is TemporalValue temporalValue)
            {
                IAttributeData attributeData = new AttributeData(null);
                for (int period = 0; period < 12; period++)
                {
                    var date  = _yearStartDate.AddMonths(period);
                    var index = temporalValue.FindChangePointIndex(new ChangePointDate(date.Year, date.Month, date.Day));
                    var val   = temporalValue.GetValue(index);
                    attributeData.AddChangepoint(new TemporalValueItem(date, val, string.Empty));
                }

                return(attributeData);
            }

            return(new AttributeData(value is string?value.ToString().Trim() : value));
        }