예제 #1
0
        public async Task AnonymiseContactDetailsData()
        {
            var contacts = await GetAllContacts();

            var collectionUri = _documentDbHelper.CreateDestinationContactDocumentCollectionUri();
            var client        = _databaseClient.CreateDestinationDocumentClient();

            var databaseName       = "contacts";
            var databaseCollection = "contacts-anonymised";

            client.CreateDocumentCollectionIfNotExistsAsync(
                UriFactory.CreateDatabaseUri(databaseName),
                new DocumentCollection {
                Id = databaseCollection
            }).
            GetAwaiter()
            .GetResult();

            foreach (var cont in contacts)
            {
                cont.EmailAddress      = _utils.RandomEmail();
                cont.MobileNumber      = _utils.RandomMobile();
                cont.HomeNumber        = _utils.RandomPhoneNumber();
                cont.AlternativeNumber = _utils.RandomPhoneNumber();

                var response = await client.CreateDocumentAsync(collectionUri, cont);
            }
        }