コード例 #1
0
        public void WhenAPartyOwnsAQuarterOfTheCertificates_ThenItIsEntitledToAQuarterOfThePowerEarnings()
        {
            // arrange
            // 25 certificates in 2012: Single transaction of 15 certificates in 2012
            List <Transaction> transactions =
                new List <Transaction> {
                new Transaction {
                    Date = new DateTime(2012, 2, 15), Amount = 2500
                }
            };

            // Plant Earning is 100
            PowerEarning powerPlant = new PowerEarning {
                Earning = 1000
            };

            List <DynamicShare>     strombezuege = new List <DynamicShare>();
            List <ConversionFactor> factor       = new List <ConversionFactor>();
            ICertificateDocument    document     = new DocumentMock();
            Address address = new Address();

            // act
            Certificate sut = new Certificate(document, 2018, address, powerPlant, transactions, strombezuege, factor)
            {
                TotalNumberOfCommittedCertificates = 100
            };

            // assert
            sut.PersonalPowerEarning.Should().Be(250, "25 out of 100 is a quarter and a quarter of 1000 kWh gives 250 kWh");
        }
コード例 #2
0
ファイル: DocumentTests.cs プロジェクト: adkl/nsi
 public void Initialize()
 {
     _documentRepositoryMock = DocumentMock.GetDocumentRepositoryMock();
     _documentManipulation   = new DocumentManipulation(
         _documentRepositoryMock.Object
         );
 }
コード例 #3
0
        public void WhenDynamicCertificatesExistForTheFuture_ThenTheseAreNotShownOnTheDocument()
        {
            const int            Year     = 2015;
            ICertificateDocument document = new DocumentMock();
            Address      address          = new Address();
            PowerEarning powerPlant       = new PowerEarning();
            // Arrange
            // 1 dynamic certificate annually between 2010 - 2019
            List <DynamicShare>     dynymicShare = new List <DynamicShare>();
            List <ConversionFactor> factor       = new List <ConversionFactor>();

            for (int year = 2010; year <= 2019; year++)
            {
                DateTime date = new DateTime(year, 12, 31);
                dynymicShare.Add(new DynamicShare {
                    AddressId = 1, Date = date, PowerPurchase = 100
                });
                factor.Add(new ConversionFactor {
                    Year = year, Factor = 1
                });
            }
            List <Transaction> fixShare = new List <Transaction>
            {
                // Subscription of 15 certificates in 2012
                new Transaction {
                    Date = new DateTime(2012, 2, 15), Amount = 1500
                },
                // Subscription of 25 certificates in 2016
                new Transaction {
                    Date = new DateTime(2016, 2, 15), Amount = 2500
                }
            };
            Certificate sut = new Certificate(document, Year, address, powerPlant, fixShare, dynymicShare, factor)
            {
                TotalNumberOfCommittedCertificates = 1
            };

            // Act
            // Calculation date 2015
            string html = sut.FillTemplateWithData(Year, null, null, DateTime.Now);

            // Assert
            html.Should().ContainAll(new List <string> {
                "2010", "2011", "2012", "2013", "2014", "2015"
            });
            html.Should().NotContainAny(new List <string> {
                "2016", "2017", "2018", "2019"
            });
            sut.NumberOfCertificatesHeld.Should().Be(21, "dynymicShare: 6 + fixShare: 15 => 21");
        }
コード例 #4
0
        public void WhenACustomerHas10DynamicÂnd15TransactionalShares_ThenTheNumberOfCommittedCertificatesMustBe25()
        {
            // arrange
            // 20 dynamic certificates: 2 dynamic certificate annually between 2010 - 2019
            List <DynamicShare>     strombezuege = new List <DynamicShare>();
            List <ConversionFactor> factor       = new List <ConversionFactor>();

            for (int year = 2010; year <= 2019; year++)
            {
                DateTime date = new DateTime(year, 12, 31);
                strombezuege.Add(new DynamicShare {
                    AddressId = 1, Date = date, PowerPurchase = 200
                });
                factor.Add(new ConversionFactor {
                    Year = year, Factor = 1
                });
            }

            // 15 certificates in 2012: Single transaction of 15 certificates in 2012
            List <Transaction> transactions =
                new List <Transaction> {
                new Transaction {
                    Date = new DateTime(2012, 2, 15), Amount = 1500
                }
            };

            ICertificateDocument document = new DocumentMock();
            Address      address          = new Address();
            PowerEarning powerPlant       = new PowerEarning();

            // act
            Certificate sut = new Certificate(document, 2018, address, powerPlant, transactions, strombezuege, factor);

            // assert
            sut.NumberOfCommittedCertificates.Should().Be(35, "20 dynamic certificates plus 15 certificates from a transaction gives a total of 35 certificates");
        }