public void СalculationPeriodTest_NotIndecationOnStart_Should_ThrowExcaption()
        {
            //arrange
            var begDate = randomizer.Create <DateTime>().Date;
            var endDate = begDate.AddMonths(1);

            var aggregate = new MeterScaleAggregate(
                randomizer.Create <long>(),
                randomizer.Create <long>(),
                randomizer.Create <string>(),
                randomizer.Create <Const.ZoneOfDay>(),
                5,
                begDate,
                endDate,
                false,
                false
                );
            var endIndication = new IndicationDocumentAggregate(randomizer.Create <long>(),
                                                                endDate,
                                                                9000,
                                                                false);

            var endIndicationDouble = new IndicationDocumentAggregate(randomizer.Create <long>(),
                                                                      endDate,
                                                                      9100,
                                                                      false);

            //act
            aggregate.AddIndication(endIndication);
            aggregate.AddIndication(endIndicationDouble);
            Action act = () => aggregate.СalculationPeriod(begDate, begDate, endDate);

            //assert
            act.Should().Throw <ArgumentException>().WithMessage("Error not find indication date");
        }
        public void СalculationPeriodTest_Indecation_NotOverDimenshion()
        {
            //arrange
            var begDate = randomizer.Create <DateTime>().Date;
            var endDate = begDate.AddMonths(1);

            var aggregate = new MeterScaleAggregate(
                randomizer.Create <long>(),
                randomizer.Create <long>(),
                randomizer.Create <string>(),
                randomizer.Create <Const.ZoneOfDay>(),
                5,
                begDate,
                endDate,
                false,
                false
                );
            var begIndication = new IndicationDocumentAggregate(randomizer.Create <long>(),
                                                                begDate,
                                                                9000,
                                                                false);
            var endIndication = new IndicationDocumentAggregate(randomizer.Create <long>(),
                                                                endDate,
                                                                9100,
                                                                false);

            //act
            aggregate.AddIndication(begIndication);
            aggregate.AddIndication(endIndication);
            var act = aggregate.СalculationPeriod(begDate, begDate, endDate);

            //assert
            act.Should().Be(100.0);
        }
Example #3
0
 public void AddIndication(IndicationDocumentAggregate indication)
 {
     CheckIndication(indication.Indication);
     indications.Add(indication);
 }