コード例 #1
0
        public async Task CreateConsent()
        {
            consentData = new CdipData();
            service     = new GrowerConsentService(consentData, confirmationTokenService);
            var id      = Guid.NewGuid().ToString();
            var consent = new GrowerConsentFormModel
            {
                GrowerConsentCommonId = id,
                ContactName           = "TestConsent",
                Email = "*****@*****.**",
            };
            await service.CreateGrowerConsent(consent);

            var insertedConsent = await consentData.GetConsent(id);

            Assert.AreEqual(consent.ContactName, insertedConsent.ContactName);
            Assert.AreEqual(consent.Email, insertedConsent.Email);
        }
コード例 #2
0
        public async Task CreateConsentCropAcres()
        {
            consentData = new CdipData();
            service     = new GrowerConsentService(consentData, confirmationTokenService);
            var consent = new GrowerConsentFormModel
            {
                GrowerConsentCommonId = Guid.NewGuid().ToString(),
                ContactName           = "TestConsent1",
                Email     = "*****@*****.**",
                CropAcres = new List <CropAcresModel>()
                {
                    new CropAcresModel
                    {
                        CropId    = Guid.NewGuid().ToString(),
                        CropName  = "Rubbish",
                        CropAcres = 100500
                    },
                    new CropAcresModel
                    {
                        CropId    = Guid.NewGuid().ToString(),
                        CropName  = "Garbage",
                        CropAcres = 1050
                    },
                }
            };
            await service.CreateGrowerConsent(consent);

            var insertedConsent = await consentData.GetConsent(consent.GrowerConsentCommonId);

            Assert.AreEqual(consent.ContactName, insertedConsent.ContactName);
            foreach (var crop in consent.CropAcres)
            {
                var insertedCrop = await consentData.GetCropAcres(crop.CropId);

                Assert.AreEqual(insertedCrop.CropName, crop.CropName);
                Assert.AreEqual(insertedCrop.CropAcres, crop.CropAcres);
            }
        }