private async void ContactForSponsorECL_TestNewContactForSponsorECL()
        {
            var contactForSponsorEdit = await ContactForSponsorECL.NewContactForSponsorECL();

            Assert.NotNull(contactForSponsorEdit);
            Assert.IsType <ContactForSponsorECL>(contactForSponsorEdit);
        }
        private async void ContactForSponsorECL_TestGetContactForSponsorECL()
        {
            var contacts = MockDb.ContactForSponsors.ToList();
            var contactForSponsorEdit = await ContactForSponsorECL.GetContactForSponsorECL(contacts);

            Assert.NotNull(contactForSponsorEdit);
            Assert.Equal(3, contactForSponsorEdit.Count);
        }
Esempio n. 3
0
        private async void ContactForSponsorECL_TestGetContactForSponsorECL()
        {
            var childData = MockDb.ContactForSponsors;

            var listToTest = await ContactForSponsorECL.GetContactForSponsorECL(childData);

            Assert.NotNull(listToTest);
            Assert.Equal(3, listToTest.Count);
        }
        private async void ContactForSponsorECL_TestUpdateContactForSponsorEditEntry()
        {
            const int idToUpdate = 1;

            var contacts = MockDb.ContactForSponsors.ToList();
            var contactForSponsorEditList = await ContactForSponsorECL.GetContactForSponsorECL(contacts);

            var countBeforeUpdate         = contactForSponsorEditList.Count;
            var contactForSponsorToUpdate = contactForSponsorEditList.First(a => a.Id == idToUpdate);

            contactForSponsorToUpdate.LastUpdatedBy = "edm";

            var updatedList = await contactForSponsorEditList.SaveAsync();

            Assert.Equal(countBeforeUpdate, updatedList.Count);
        }
        private async void ContactForSponsorECL_TestDeleteContactForSponsorEditEntry()
        {
            var contacts = MockDb.ContactForSponsors.ToList();
            var contactForSponsorEdit = await ContactForSponsorECL.GetContactForSponsorECL(contacts);

            var listCount = contactForSponsorEdit.Count;
            var contactForSponsorToDelete = contactForSponsorEdit.First(et => et.Id == 99);

            // remove is deferred delete
            var isDeleted = contactForSponsorEdit.Remove(contactForSponsorToDelete);

            var contactForSponsorListAfterDelete = await contactForSponsorEdit.SaveAsync();

            Assert.NotNull(contactForSponsorListAfterDelete);
            Assert.IsType <ContactForSponsorECL>(contactForSponsorListAfterDelete);
            Assert.True(isDeleted);
            Assert.NotEqual(listCount, contactForSponsorListAfterDelete.Count);
        }
        private async void ContactForSponsorECL_TestAddContactForSponsorEditEntry()
        {
            using var dalManager = DalFactory.GetManager();
            var dal      = dalManager.GetProvider <IContactForSponsorDal>();
            var contacts = await dal.Fetch();

            var contactForSponsorEditList = await ContactForSponsorECL.GetContactForSponsorECL(contacts);

            var countBeforeAdd = contactForSponsorEditList.Count;

            var contactForSponsorToAdd = contactForSponsorEditList.AddNew();

            BuildContactForSponsor(contactForSponsorToAdd);

            var updatedContactForSponsorECL = await contactForSponsorEditList.SaveAsync();

            Assert.NotEqual(countBeforeAdd, updatedContactForSponsorECL.Count);
        }