public void TestInsert(RepositoryStoreFactory <TestDocument> repository, string applicationName, string key, string value) { var result = repository.AddAsync(new TestDocument { ApplicationName = applicationName, Key = key, Value = value }).Result; Assert.IsTrue(result.IsSuccessful); var searchResult = repository.SearchASingleItemAsync(x => x.Key == key).Result; Assert.IsNotNull(searchResult); Assert.IsTrue(searchResult.IsSuccessful); }
public void TestInsertDuplicate(RepositoryStoreFactory <TestDocument> repository, string applicationName, string key, string value) { Assert.ThrowsException <DuplicateNameException>(() => { try { repository.AddAsync(new TestDocument { ApplicationName = applicationName, Key = key, Value = value }).Wait(); } catch (AggregateException ex) { if (ex is AggregateException aggregate) { aggregate.Handle((x) => throw x); } throw; } }); }