public static async Task CleanUpPersonFromLocalStorage(string context, string id) { var initializer = InitializeTableStorage(); var repo = new AzureTableStorageRepository <StoredPersonalInfo>(initializer, new Mock <ILogger>().Object); var person = await repo.RetrieveRecord(context, id); if (person != null) { await repo.DeleteRecord(person); } }
public static async Task CleanUpContextMapping(string context) { var initializer = InitializeTableStorage(); var repo = new AzureTableStorageRepository <ContextMapping>(initializer, new Mock <ILogger>().Object); var mapping = await repo.RetrieveRecord("PersonInfo", context); if (mapping != null) { await repo.DeleteRecord(mapping); } }
public async Task RepositoryIsAbleToConnectAndManagePersonalInfo() { var initializer = AzureTableStorageHelper.InitializeTableStorage(); var repo = new AzureTableStorageRepository <StoredPersonalInfo>(initializer, new Mock <ILogger>().Object); var partitionKey = "AzureTableStorageClientIntegrationTests"; var rowKey = "R234568"; // Clean up var sut = await repo.RetrieveRecord(partitionKey, rowKey); if (sut != null) { await repo.DeleteRecord(sut); } // Insert await repo.InsertRecordToTable(new StoredPersonalInfo() { PartitionKey = partitionKey, RowKey = rowKey, initials = "AP", lastNameAtBirthPrefix = "Aylen Perez", lastNameAtBirth = "", birthdate = "28/09/1976" }); sut = await repo.RetrieveRecord(partitionKey, rowKey); Assert.IsNotNull(sut); Assert.IsInstanceOfType(sut, typeof(StoredPersonalInfo)); // Delete await repo.DeleteRecord(sut); sut = await repo.RetrieveRecord(partitionKey, rowKey); Assert.IsNull(sut); }
public async Task RepositoryIsAbleToConnectAndManageContextMappings() { var initializer = AzureTableStorageHelper.InitializeTableStorage(); var repo = new AzureTableStorageRepository <ContextMapping>(initializer, new Mock <ILogger>().Object); var partitionKey = "PersonInfo"; var rowKey = "AzureTableStorageClientIntegrationTests"; // Clean up var sut = await repo.RetrieveRecord(partitionKey, rowKey); if (sut != null) { await repo.DeleteRecord(sut); } // Insert await repo.InsertRecordToTable(new ContextMapping() { PartitionKey = partitionKey, RowKey = rowKey, URL = "http://localhost:9002/youforcereseolver" }); sut = await repo.RetrieveRecord(partitionKey, rowKey); Assert.IsNotNull(sut); Assert.IsInstanceOfType(sut, typeof(ContextMapping)); Assert.IsFalse(string.IsNullOrEmpty(sut.URL)); // Delete await repo.DeleteRecord(sut); sut = await repo.RetrieveRecord(partitionKey, rowKey); Assert.IsNull(sut); }
public static async Task EnsureContextMappingIsCreated(string context, string url) { var initializer = InitializeTableStorage(); var repo = new AzureTableStorageRepository <ContextMapping>(initializer, new Mock <ILogger>().Object); var mapping = await repo.RetrieveRecord("PersonInfo", context); if (mapping != null) { await repo.DeleteRecord(mapping); } await repo.InsertRecordToTable(new ContextMapping() { PartitionKey = "PersonInfo", RowKey = context, URL = url }); }
public static async Task EnsurePersonIsInLocalStorage(string context, string id, string initials, string lastNameAtBirth, string lastNameAtBirthPrefix, DateTime birthdate) { var initializer = InitializeTableStorage(); var repo = new AzureTableStorageRepository <StoredPersonalInfo>(initializer, new Mock <ILogger>().Object); var person = await repo.RetrieveRecord(context, id); if (person != null) { await repo.DeleteRecord(person); } await repo.InsertRecordToTable(new StoredPersonalInfo() { PartitionKey = context, RowKey = id, initials = initials, lastNameAtBirth = lastNameAtBirth, lastNameAtBirthPrefix = lastNameAtBirthPrefix, birthdate = birthdate.ToString("dd/MM/yyyy", CultureInfo.CreateSpecificCulture("nl")) }); }