public void EndWithProperties()
        {
            var properties = new EffectiveProperties <EffectivePropertyTestClass>();

            var start = new Date(2019, 12, 01);

            properties.Change(start, new EffectivePropertyTestClass("InitialValue"));

            var change = new Date(2019, 12, 31);

            properties.Change(change, new EffectivePropertyTestClass("Change1"));

            var end = new Date(2020, 01, 15);

            properties.End(end);

            properties.Values.Should().SatisfyRespectively(
                first =>
            {
                first.EffectivePeriod.Should().Be(new DateRange(change, end));
                first.Properties.Value.Should().Be("Change1");
            },
                second =>
            {
                second.EffectivePeriod.Should().Be(new DateRange(start, change.AddDays(-1)));
                second.Properties.Value.Should().Be("InitialValue");
            }
                );
        }
        public void PropertyAtDate(Date date, string result, bool exception)
        {
            var properties = new EffectiveProperties <EffectivePropertyTestClass>();

            var start = new Date(2019, 12, 01);

            properties.Change(start, new EffectivePropertyTestClass("InitialValue"));

            var change1 = new Date(2019, 12, 15);

            properties.Change(change1, new EffectivePropertyTestClass("Change1"));

            var change2 = new Date(2019, 12, 31);

            properties.Change(change2, new EffectivePropertyTestClass("Change2"));

            var end = new Date(2020, 01, 17);

            properties.End(end);

            if (!exception)
            {
                properties[date].Value.Should().Be(result);
            }
            else
            {
                Action a = () => { var x = properties[date]; };
                a.Should().Throw <KeyNotFoundException>();
            }
        }
        public void EndWithNoExistingProperties()
        {
            var properties = new EffectiveProperties <EffectivePropertyTestClass>();

            var    end = new Date(2019, 11, 15);
            Action a   = () => properties.End(end);

            a.Should().Throw <EffectiveDateException>();
        }
Пример #4
0
        public virtual void Apply(StockDelistedEvent @event)
        {
            Version++;

            _Properties.End(@event.DelistedDate);
            _DividendRules.End(@event.DelistedDate);

            End(@event.DelistedDate);
        }
        public void EndAnAlreadyEndedProperty()
        {
            var properties = new EffectiveProperties <EffectivePropertyTestClass>();

            var start = new Date(2019, 12, 01);

            properties.Change(start, new EffectivePropertyTestClass("InitialValue"));

            var change1 = new Date(2019, 12, 15);

            properties.Change(change1, new EffectivePropertyTestClass("Change1"));

            var change2 = new Date(2019, 12, 31);

            properties.Change(change2, new EffectivePropertyTestClass("Change2"));

            var end = new Date(2020, 01, 17);

            properties.End(end);

            Action a = () => properties.End(end);

            a.Should().Throw <EffectiveDateException>();
        }
        public void EndOnStartDate()
        {
            var properties = new EffectiveProperties <EffectivePropertyTestClass>();

            var start = new Date(2019, 12, 01);

            properties.Change(start, new EffectivePropertyTestClass("InitialValue"));

            properties.End(start);

            properties.Values.Should().SatisfyRespectively(
                first =>
            {
                first.EffectivePeriod.Should().Be(new DateRange(start, start));
                first.Properties.Value.Should().Be("InitialValue");
            }
                );
        }
        public void MatchesWithDateRange(DateRange dateRange, string value, bool result)
        {
            var properties = new EffectiveProperties <EffectivePropertyTestClass>();

            var start = new Date(2019, 12, 01);

            properties.Change(start, new EffectivePropertyTestClass("InitialValue"));

            var change1 = new Date(2019, 12, 15);

            properties.Change(change1, new EffectivePropertyTestClass("Change1"));

            var change2 = new Date(2019, 12, 31);

            properties.Change(change2, new EffectivePropertyTestClass("Change2"));

            var end = new Date(2020, 01, 17);

            properties.End(end);

            properties.Matches(dateRange, x => x.Value == value).Should().Be(result);
        }
        public void ClosestToDate(Date date, string result)
        {
            var properties = new EffectiveProperties <EffectivePropertyTestClass>();

            var start = new Date(2019, 12, 01);

            properties.Change(start, new EffectivePropertyTestClass("InitialValue"));

            var change1 = new Date(2019, 12, 15);

            properties.Change(change1, new EffectivePropertyTestClass("Change1"));

            var change2 = new Date(2019, 12, 31);

            properties.Change(change2, new EffectivePropertyTestClass("Change2"));

            var end = new Date(2020, 01, 17);

            properties.End(end);

            properties.ClosestTo(date).Value.Should().Be(result);
        }
        public void Value()
        {
            var properties = new EffectiveProperties <EffectivePropertyTestClass>();

            var start = new Date(2019, 12, 01);

            properties.Change(start, new EffectivePropertyTestClass("InitialValue"));

            var change1 = new Date(2019, 12, 15);

            properties.Change(change1, new EffectivePropertyTestClass("Change1"));

            var change2 = new Date(2019, 12, 31);

            properties.Change(change2, new EffectivePropertyTestClass("Change2"));

            var end = new Date(2020, 01, 17);

            properties.End(end);

            properties.Value(new Date(2019, 12, 17)).EffectivePeriod.Should().Be(new DateRange(new Date(2019, 12, 15), new Date(2019, 12, 30)));
        }
Пример #10
0
        public override void Apply(StockDelistedEvent @event)
        {
            base.Apply(@event);

            _RelativeNTAs.End(@event.DelistedDate);
        }