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));
        }
Example #2
0
        public void SummarizeResourcesToFormattedString_OneDeviceDE_PrintsInCorrectFormat()
        {
            var device        = _captainHookGenerator.GenerateDevice();
            var resourcesList = new ResourceCompilation();

            resourcesList.devices.Add(device);
            var summary = MailService.SummarizeResourcesToFormattedString(resourcesList, "de");

            Assert.Equal("1 neues Angebot gefunden:" + Environment.NewLine +
                         "Geräte:" + Environment.NewLine +
                         "+ 5 PCR Thermocycler" + Environment.NewLine,
                         summary);
        }
Example #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));
        }