public async Task GivenKP17Data_WhenGenerateReport_ThenBataillonIsTheSameAsCompany()
        {
            const string company = "Riststabskp 17";

            GivenCompany(company);
            GivenDuro();

            _materialDispositionContext.GivenInventoryItems(new MaterialInventoryItem
            {
                SapNr        = DuroSapNr,
                Company      = company,
                Distribution = new List <MaterialAllocation>
                {
                    MaterialAllocation.For("Langnau i.E.", 12, 10, 2)
                }
            });

            var sut = new BataillonReporter(_dispositionContext, _materialDispositionContext, _servantDispositionContext);
            await sut.GenerateDispositionReport(new DateTime(2018, 10, 31, 0, 0, 0, DateTimeKind.Utc));

            var materialReport = await GetMaterialReport();

            var reportItem = materialReport.MaterialReportItems.Single(item => item.Material.SapNr == DuroSapNr);

            reportItem.Damaged.Should().Be(2);
            reportItem.Used.Should().Be(10);
            reportItem.Stock.Should().Be(12);
            reportItem.PerCompany.Should().HaveCount(1);
        }
Пример #2
0
 private void GivenPuchIventory()
 {
     _materialDispositionContext.GivenInventoryItems(new MaterialInventoryItem
     {
         SapNr        = PuchSapNr,
         Company      = CompanyName,
         Distribution = new List <MaterialAllocation>
         {
             MaterialAllocation.For("Bern", 12, 10, 2)
         }
     });
 }
Пример #3
0
        private async Task <string> GivenCompanyWithInventory()
        {
            var companyId = await GivenCompany("KP Rw", "Langnau i.E.");

            _materialDispositionContext.GivenInventoryItems(new MaterialInventoryItem
            {
                Company      = CompanyName,
                SapNr        = "256.165",
                Distribution = new List <MaterialAllocation>
                {
                    MaterialAllocation.For("KP Rw", 5)
                }
            });

            return(companyId);
        }
Пример #4
0
        private async Task <string> GivenCompanyWithKpFront()
        {
            var companyId = await GivenCompany("KP Rw", "KP Front", "Somewhere");

            _materialDispositionContext.GivenInventoryItems(new MaterialInventoryItem
            {
                Company      = CompanyName,
                SapNr        = "256.165",
                Distribution = new List <MaterialAllocation>
                {
                    MaterialAllocation.For("Somewhere", 5),
                    MaterialAllocation.For("KP Rw", 0),
                    MaterialAllocation.For("KP Front", 0),
                }
            });
            return(companyId);
        }
        public async Task GivenKp1AndKp2_WhenGenerateReport_ThenBattionIsSumOfBoth()
        {
            GivenDuro();

            _materialDispositionContext.GivenInventoryItems(new MaterialInventoryItem
            {
                SapNr        = DuroSapNr,
                Company      = "KP 17/1",
                Distribution = new List <MaterialAllocation>
                {
                    MaterialAllocation.For("Bern", 12, 10, 2)
                }
            });

            _materialDispositionContext.GivenInventoryItems(new MaterialInventoryItem
            {
                SapNr        = DuroSapNr,
                Company      = "KP 17/2",
                Distribution = new List <MaterialAllocation>
                {
                    MaterialAllocation.For("Willisau", 10, 5, 5)
                }
            });

            var sut = new BataillonReporter(_dispositionContext, _materialDispositionContext, _servantDispositionContext);
            await sut.GenerateDispositionReport(new DateTime(2018, 10, 31, 0, 0, 0, DateTimeKind.Utc));

            var materialReport = await GetMaterialReport();

            var reportItem = materialReport.MaterialReportItems.Single(item => item.Material.SapNr == DuroSapNr);

            reportItem.Damaged.Should().Be(7);
            reportItem.Used.Should().Be(15);
            reportItem.Stock.Should().Be(22);
            reportItem.PerCompany.Should().HaveCount(2);
            reportItem.PerCompany.Should().Contain(perComp => perComp.Company == "KP 17/1");
            reportItem.PerCompany.Should().Contain(perComp => perComp.Company == "KP 17/2");
        }
Пример #6
0
 public DistributionChanged(string sapNr, string company, string location, MaterialAllocation material) : base(sapNr,
                                                                                                               company, location, MaterialEventType.DistributionChanged)
 {
     Material = material;
 }