示例#1
0
        public void InvoiceAggregate_ShouldBeDeleted()
        {
            //Arrange
            var request = AggregatesRequestBuilder.CreateRandomInvoiceCreateRequest();
            var invoice = InvoiceAggregate.CreateFromRequest(request);

            //Act
            invoice.MarkAsDeleted();

            //Assert
            invoice.IsDeleted.Should().BeTrue();
        }
示例#2
0
        public void InvoiceAggregate_CreateFromRequest()
        {
            //Arrange
            var request = AggregatesRequestBuilder.CreateRandomInvoiceCreateRequest();

            //Act
            var invoice = InvoiceAggregate.CreateFromRequest(request);

            //Assert
            invoice.ContractId.Should().Be(request.ContractId);
            invoice.DateStart.Should().Be(request.DateStart);
            invoice.DateEnd.Should().Be(request.DateEnd);
            invoice.IsDeleted.Should().BeFalse();
        }
示例#3
0
        public void InvoiceAggregate_CalculateSomeSum_AfterIncludeSomeSheets()
        {
            //Arrange
            var invoiceRequest = AggregatesRequestBuilder.CreateRandomInvoiceCreateRequest();
            var invoice        = InvoiceAggregate.CreateFromRequest(invoiceRequest);

            var sheets      = new List <SheetAggregate>();
            var sheetsCount = 3;

            for (int i = 0; i < sheetsCount; i++)
            {
                var sheetRequest = AggregatesRequestBuilder.CreateRandomSheetCreateRequest();
                sheets.Add(SheetAggregate.CreateFromRequest(sheetRequest));
            }

            //Act
            invoice.IncludeSheets(sheets);

            //Assert
            invoice.Sum.Amount.Should().BeGreaterThan(0);
            invoice.Sheets.Count.Should().Be(sheetsCount);
        }