public async Task Update_NotFound_Async() { var updateItem = new TestItemBare(); updateItem.InitializeWithDataForTesting(TypeOfTestDataEnum.Default); await CrudStorage.UpdateAsync(CrudHelper.CreateNewId <TId>(), updateItem); Assert.Fail("Expected an exception"); }
public async Task CreateAndReturn_Async() { var initialItem = new TestItemBare(); initialItem.InitializeWithDataForTesting(TypeOfTestDataEnum.Default); var createdItem = await CrdStorage.CreateAndReturnAsync(initialItem); Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsNotNull(createdItem); Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(initialItem, createdItem); }
public async Task TestWithDefaultId() { var item = new TestItemBare(); item.InitializeWithDataForTesting(TypeOfTestDataEnum.Default); await ExpectContractExceptionAsync(async() => await _implementation.CreateWithSpecifiedIdAsync(Guid.Empty, item), "CreateWithSpecifiedIdAsync(Guid.Empty, item)"); await ExpectContractExceptionAsync(async() => await _implementation.CreateWithSpecifiedIdAndReturnAsync(Guid.NewGuid(), null), "CreateWithSpecifiedIdAndReturnAsync(Guid.Empty, item)"); }
public async Task MessageGetsThrough() { var message = new TestItemBare(); message.InitializeWithDataForTesting(TypeOfTestDataEnum.Variant1); await Queue.AddMessageAsync(message); var result = await Queue.GetOneMessageNoBlockAsync(); Assert.IsNotNull(result); Assert.AreEqual(message, result); }
public async Task CreateAndReturn_Read_Etag_Async() { var initialItem = new TestItemBare(); initialItem.InitializeWithDataForTesting(TypeOfTestDataEnum.Default); var createdItem = await CrdStorage.CreateAndReturnAsync(initialItem); Assert.IsNotNull(createdItem); Assert.AreNotEqual(createdItem.Id, default); Assert.IsNotNull(createdItem.Etag); Assert.AreEqual(initialItem, createdItem); }
public async Task Create_Read_Async() { var initialItem = new TestItemBare(); initialItem.InitializeWithDataForTesting(TypeOfTestDataEnum.Default); var id = await CrdStorage.CreateAsync(initialItem); var createdItem = await CrdStorage.ReadAsync(id); Assert.IsNotNull(createdItem); Assert.AreEqual(initialItem, createdItem); }
public async Task ClearQueue() { var message = new TestItemBare(); message.InitializeWithDataForTesting(TypeOfTestDataEnum.Variant1); await Queue.AddMessageAsync(message); await Queue.ClearAsync(); var getTask = Queue.GetOneMessageNoBlockAsync(); await Task.Delay(TimeSpan.FromMilliseconds(100)); Assert.IsTrue(getTask.IsCompleted, "Expected the method to finish quickly."); Assert.IsNull(await getTask); }
public async Task Delete_Async() { var initialItem = new TestItemBare(); initialItem.InitializeWithDataForTesting(TypeOfTestDataEnum.Default); var id = await CrdStorage.CreateAsync(initialItem); await CrdStorage.ReadAsync(id); await CrdStorage.DeleteAsync(id); var item = await CrdStorage.ReadAsync(id); Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsNull(item); }
public async Task PeekAndGet() { var message = new TestItemBare(); message.InitializeWithDataForTesting(TypeOfTestDataEnum.Variant1); await Queue.AddMessageAsync(message); var result = await Queue.PeekNoBlockAsync(); Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsNotNull(result); Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(message, result); result = await Queue.GetOneMessageNoBlockAsync(); Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsNotNull(result); Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(message, result); }