public void IncludeUpdateTest()
        {
            var sheetBuilder   = new SheetAggregateBuilder();
            var sheetAggregate = sheetBuilder.CreateRandomSheet();
            var sheet          = SheetAggregate.Update(sheetAggregate.Id, sheetAggregate);

            sheetAggregate.Should().BeEquivalentTo(sheet);
        }
        public void ChangeEmployeeTest(Guid newEmployeeId)
        {
            var builder = new SheetAggregateBuilder();
            var sheet   = builder.CreateRandomSheet();

            sheet.ChangeEmployee(newEmployeeId);

            sheet.EmployeeId.Should().Be(newEmployeeId);
        }
        public void ApproveSheetTest()
        {
            var builder = new SheetAggregateBuilder();
            var sheet   = builder.CreateRandomSheet();

            sheet = SheetAggregate.ApproveSheet(sheet.Id, sheet);

            sheet.IsApproved.Should().BeTrue();
            sheet.ApprovedDate.Should().BeExactly(TimeSpan.FromSeconds(DateTimeOffset.Now.ToUnixTimeSeconds()));
        }
        public void CreateFromRequestTest()
        {
            var builder = new SheetAggregateBuilder();
            var sheet   = builder.CreateRandomSheet();

            sheet.Amount.Should().Be(builder.amountForRandomSheets);
            sheet.ContractId.Should().Be(builder.SheetContractId);
            sheet.EmployeeId.Should().Be(builder.SheetEmployeeId);
            sheet.ServiceId.Should().Be(builder.SheetServiceId);
            sheet.Date.Should().BeExactly(TimeSpan.FromSeconds(DateTimeOffset.Now.ToUnixTimeSeconds()));
        }
        public void CreateTest()
        {
            var builder = new SheetAggregateBuilder();
            var sheet   = SheetAggregate.Create(
                builder.amountForRandomSheets,
                builder.SheetContractId,
                DateTime.Now,
                builder.SheetEmployeeId,
                builder.SheetServiceId);

            sheet.Should().As <SheetAggregate>();
        }
Beispiel #6
0
        public void IncludeSheetsTest()
        {
            var          invoiceBuilder = new InvoiceAggregateBuilder();
            int          numOfSheets    = 3;
            var          sheetBuilder   = new SheetAggregateBuilder();
            List <Sheet> TestSheets     = new List <Sheet>();

            for (int i = 0; i < numOfSheets; i++)
            {
                TestSheets.Add(sheetBuilder.CreateRandomSheet());
            }

            var invoiceAggregate = invoiceBuilder.GetRandomInvoiceAggregate();

            invoiceAggregate.IncludeSheets(TestSheets);

            Money sum = Money.FromDeciaml(numOfSheets * sheetBuilder.amountForRandomSheets * 150);

            invoiceAggregate.Sheets.Should().BeEquivalentTo(TestSheets);
            invoiceAggregate.Sum.Should().BeEquivalentTo(sum);
        }