Beispiel #1
0
        public void SummarizeResourcesToFormattedString_OneConsumableDE_PrintsInCorrectFormat()
        {
            var consumable    = _captainHookGenerator.GenerateConsumable();
            var resourcesList = new ResourceCompilation();

            resourcesList.consumables.Add(consumable);
            var summary = MailService.SummarizeResourcesToFormattedString(resourcesList, "de");

            Assert.Equal(
                "1 neues Angebot gefunden:" + Environment.NewLine +
                "Verbrauchsmaterial:" + Environment.NewLine +
                "+ Schutzkleidung: 40 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));
        }
Beispiel #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));
        }