Пример #1
0
        public void SummarizeResourcesToFormattedString_1Personal3Devices2ConsumablesDE_PrintsInCorrectFormat()
        {
            var personal1     = _captainHookGenerator.GeneratePersonal();
            var device1       = _captainHookGenerator.GenerateDevice();
            var device2       = _captainHookGenerator.GenerateDevice();
            var device3       = _captainHookGenerator.GenerateDevice();
            var consumable1   = _captainHookGenerator.GenerateConsumable();
            var consumable2   = _captainHookGenerator.GenerateConsumable();
            var resourcesList = new ResourceCompilation();

            resourcesList.personals.Add(personal1);
            resourcesList.devices.Add(device1);
            resourcesList.devices.Add(device2);
            resourcesList.devices.Add(device3);
            resourcesList.consumables.Add(consumable1);
            resourcesList.consumables.Add(consumable2);
            var summary = MailService.SummarizeResourcesToFormattedString(resourcesList, "de");

            Assert.Equal(
                "6 neue Angebote gefunden:" + Environment.NewLine +
                "Personal:" + Environment.NewLine +
                "+ 1 Helfer" + Environment.NewLine +
                "Geräte:" + Environment.NewLine +
                "+ 15 PCR Thermocycler" + Environment.NewLine +
                "Verbrauchsmaterial:" + Environment.NewLine +
                "+ Schutzkleidung: 80 Packung" + Environment.NewLine,
                summary
                );
        }
        public void Test_AddResource_InvalidValues_Error()
        {
            Device newDevice = _captainHookGenerator.GenerateDevice();

            newDevice.name       = ""; // Invalid!
            newDevice.annotation = "Brand new";
            Consumable newConsumable = _captainHookGenerator.GenerateConsumable();

            newConsumable.amount   = 0; // Invalid!
            newConsumable.category = "PIPETTENSPITZEN";
            Personal newPersonal = _captainHookGenerator.GeneratePersonal();

            newPersonal.qualification = null; // Invalid!

            Assert.Throws <ArgumentException>(() => _service.ValidateForStockInsertion(newDevice));

            Assert.Throws <ArgumentException>(() => _service.ValidateForStockInsertion(newConsumable));

            Assert.Throws <ArgumentException>(() => _service.ValidateForStockInsertion(newPersonal));
        }
Пример #3
0
        public async void Test_AddResource_Possible()
        {
            Offer  oldOffer  = _offer;
            Device newDevice = _captainHookGenerator.GenerateDevice();

            newDevice.name       = "A new name";
            newDevice.annotation = "Brand new";
            Consumable newConsumable = _captainHookGenerator.GenerateConsumable();

            newConsumable.amount   = 20;
            newConsumable.category = "PIPETTENSPITZEN";
            Personal newPersonal = _captainHookGenerator.GeneratePersonal();

            newPersonal.qualification = "PHD_STUDENT";

            await _resourceStockUpdateService.AddResourceAsync(_token, newDevice);

            Offer newOffer = await _resourceStockQueryService.QueryLinkAsync(_token);

            Assert.Equal(oldOffer.devices.Count + 1, newOffer.devices.Count);
            Assert.Equal(newDevice, newOffer.devices.Find(x => x.id == newDevice.id));

            await _resourceStockUpdateService.AddResourceAsync(_token, newConsumable);

            newOffer = await _resourceStockQueryService.QueryLinkAsync(_token);

            Assert.Equal(oldOffer.consumables.Count + 1, newOffer.consumables.Count);
            Assert.Equal(newConsumable, newOffer.consumables.Find(x => x.id == newConsumable.id));

            await _resourceStockUpdateService.AddResourceAsync(_token, newPersonal);

            newOffer = await _resourceStockQueryService.QueryLinkAsync(_token);

            Assert.Equal(oldOffer.personals.Count + 1, newOffer.personals.Count);
            Assert.Equal(newPersonal, newOffer.personals.Find(x => x.id == newPersonal.id));
        }