public async Task Run()
        {
            /*
             * PLACE OF BIRTH
             */

            // Creating a new Place of Birth
            PlaceOfBirthResponse created = await Create(staticVault);

            // Retrieving a existent Place of Birth
            PlaceOfBirthResponse retrieved = await Retrieve(staticVault, created.Id);

            await RetrieveFromRealData(staticVault, created.PlaceOfBirth);

            // Deleting a existent Place of Birth
            await Delete(staticVault, retrieved.Id);

            /*
             * PLACE OF BIRTH WITH STATE
             */

            // Creating a new Place of Birth with State
            PlaceOfBirthResponse createdWithState = await CreateWithState(staticVault);

            // Retrieving a existent Place of Birth
            PlaceOfBirthResponse retrievedWithState = await Retrieve(staticVault, createdWithState.Id);

            await RetrieveFromRealData(staticVault, createdWithState.PlaceOfBirth);

            // Deleting a existent Place of Birth
            await Delete(staticVault, retrievedWithState.Id);
        }
示例#2
0
        public async Task Run()
        {
            var sdk    = new Nullafi.NullafiSDK(Environment.GetEnvironmentVariable("API_KEY"));
            var client = await sdk.CreateClient();

            var staticVault = await client.CreateStaticVault("Place of Birth Vault Example", null);

            PlaceOfBirthResponse created = await Create(staticVault);

            PlaceOfBirthResponse retrieved = await Retrieve(staticVault, created.Id);

            await RetrieveFromRealData(staticVault, created.PlaceOfBirth);
            await Delete(staticVault, retrieved.Id);

            Assert.AreEqual(created.Id, retrieved.Id);
            Assert.AreEqual(created.PlaceOfBirth, retrieved.PlaceOfBirth);
            Assert.AreEqual(created.PlaceOfBirthAlias, retrieved.PlaceOfBirthAlias);

            PlaceOfBirthResponse createdWithState = await CreateWithState(staticVault);

            PlaceOfBirthResponse retrievedWithState = await Retrieve(staticVault, createdWithState.Id);

            await RetrieveFromRealData(staticVault, createdWithState.PlaceOfBirth);
            await Delete(staticVault, retrievedWithState.Id);

            Assert.AreEqual(createdWithState.Id, retrievedWithState.Id);
            Assert.AreEqual(createdWithState.PlaceOfBirth, retrievedWithState.PlaceOfBirth);
            Assert.AreEqual(createdWithState.PlaceOfBirthAlias, retrievedWithState.PlaceOfBirthAlias);

            await client.DeleteStaticVault(staticVault.VaultId);
        }
        private async Task <PlaceOfBirthResponse> Retrieve(StaticVault vault, String id)
        {
            PlaceOfBirthResponse retrieved = await vault.PlaceOfBirth.Retrieve(id);

            Console.WriteLine("//// PlaceOfBirthExample.retrieve:");
            Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(retrieved));

            return(retrieved);
        }
        private async Task <PlaceOfBirthResponse> Create(StaticVault vault)
        {
            String name = "Example With Space";

            PlaceOfBirthResponse created = await vault.PlaceOfBirth.Create(name);

            Console.WriteLine("//// PlaceOfBirthExample.create:");
            Console.WriteLine("/// Name: " + name);
            Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(created));

            return(created);
        }