public async Task Constr_EmptySourceCollectionAndAwaitingInitialization_NoElements() { //Arrange ObservableCollection <A> filledCollection = new ObservableCollection <A>(); DeferredWrappingObservableReadOnlyList <A> readOnlyList = new DeferredWrappingObservableReadOnlyList <A>(Task.FromResult(filledCollection)); //Act await readOnlyList.InitializedCollectionAsync.ConfigureAwait(false); //Assert StandardCheck(filledCollection, readOnlyList); }
public async Task Clear_FilledCollectionAndAwaitingInitializationAfterClearance_NoElements() { //Arrange ObservableCollection <A> filledCollection = FilledSourceCollection; DeferredWrappingObservableReadOnlyList <A> readOnlyList = new DeferredWrappingObservableReadOnlyList <A>(Task.FromResult(filledCollection)); //Act filledCollection.Clear(); await readOnlyList.InitializedCollectionAsync.ConfigureAwait(false); //Assert StandardCheck(filledCollection, readOnlyList); }
public async Task RemoveAt_FilledCollectionAndAwaitingInitializationAfterRemoval_RemovedElementExcluded() { //Arrange ObservableCollection <A> filledCollection = FilledSourceCollection; DeferredWrappingObservableReadOnlyList <A> readOnlyList = new DeferredWrappingObservableReadOnlyList <A>(Task.FromResult(filledCollection)); int removedIndex = 1; //Act filledCollection.RemoveAt(removedIndex); await readOnlyList.InitializedCollectionAsync.ConfigureAwait(false); //Assert StandardCheck(filledCollection, readOnlyList); }
public async Task Addition_FilledCollectionAndAwaitingInitializationAfterAddition_AddedElementIncluded() { //Arrange ObservableCollection <A> filledCollection = FilledSourceCollection; DeferredWrappingObservableReadOnlyList <A> readOnlyList = new DeferredWrappingObservableReadOnlyList <A>(Task.FromResult(filledCollection)); A addedA = new A(); //Act filledCollection.Add(addedA); await readOnlyList.InitializedCollectionAsync.ConfigureAwait(false); //Assert StandardCheck(filledCollection, readOnlyList); }
public async Task Replace_FilledCollectionAndAwaitingInitializationAfterReplacement_IncludesReplacedElement() { //Arrange ObservableCollection <A> filledCollection = FilledSourceCollection; DeferredWrappingObservableReadOnlyList <A> readOnlyList = new DeferredWrappingObservableReadOnlyList <A>(Task.FromResult(filledCollection)); A replacingA = new A(); int replaceIndex = 1; //Act filledCollection[replaceIndex] = replacingA; await readOnlyList.InitializedCollectionAsync.ConfigureAwait(false); //Assert StandardCheck(filledCollection, readOnlyList); }
public async Task Insertion_FilledCollectionAndAwaitingInitializationBeforeInsertion_InsertedElementIncluded() { //Arrange ObservableCollection <A> filledCollection = FilledSourceCollection; DeferredWrappingObservableReadOnlyList <A> readOnlyList = new DeferredWrappingObservableReadOnlyList <A>(Task.FromResult(filledCollection)); A insertedA = new A(); int insertIndex = 1; //Act filledCollection.Insert(insertIndex, insertedA); await readOnlyList.InitializedCollectionAsync.ConfigureAwait(false); //Assert StandardCheck(filledCollection, readOnlyList); }
public async Task Move_FilledCollectionAndAwaitingInitializationAfterMovement_MovedElementOnRightPosition() { //Arrange ObservableCollection <A> filledCollection = FilledSourceCollection; DeferredWrappingObservableReadOnlyList <A> readOnlyList = new DeferredWrappingObservableReadOnlyList <A>(Task.FromResult(filledCollection)); int moveFromIndex = 1; int moveToIndex = 3; //Act filledCollection.Move(moveFromIndex, moveToIndex); await readOnlyList.InitializedCollectionAsync.ConfigureAwait(false); //Assert StandardCheck(filledCollection, readOnlyList); }
public void ConstrLongLastingTask_FilledCollectionAndNotAwaitingInitialization_NoElements() { //Arrange ObservableCollection <A> filledCollection = FilledSourceCollection; DeferredWrappingObservableReadOnlyList <A> readOnlyList = new DeferredWrappingObservableReadOnlyList <A>( Task.Run(async() => { await Task.Delay(100).ConfigureAwait(false); return(filledCollection); })); //Act //Assert UninitializedCheck(readOnlyList); }
public async Task ConstrLongLastingTask_FilledCollectionAndAwaitingInitialization_ElementsCanBeIterated() { //Arrange ObservableCollection <A> filledCollection = FilledSourceCollection; DeferredWrappingObservableReadOnlyList <A> readOnlyList = new DeferredWrappingObservableReadOnlyList <A>( Task.Run(async() => { await Task.Delay(100).ConfigureAwait(false); return(filledCollection); })); //Act await readOnlyList.InitializedCollectionAsync.ConfigureAwait(false); //Assert StandardCheck(filledCollection, readOnlyList); }
public async Task DeferredLinkedToTransforming_AwaitInitialization_TransformingHasAllInitializedElements() { //Arrange var filledSourceCollection = FilledSourceCollection; DeferredWrappingObservableReadOnlyList <A> readOnlyList = new DeferredWrappingObservableReadOnlyList <A>( Task.Run(async() => { await Task.Delay(100).ConfigureAwait(false); return(filledSourceCollection); })); TransformingObservableReadOnlyList <A, A> proxy = new TransformingObservableReadOnlyList <A, A>( readOnlyList, a => a); //Act await readOnlyList.InitializedCollectionAsync.ConfigureAwait(false); //Assert StandardCheck(filledSourceCollection, proxy); }
public async Task AdditionLongLastingTask_FilledCollectionAndAwaitingInitializationAfterAddition_AddedElementIncluded() { //Arrange ObservableCollection <A> filledCollection = FilledSourceCollection; DeferredWrappingObservableReadOnlyList <A> readOnlyList = new DeferredWrappingObservableReadOnlyList <A>( Task.Run(async() => { await Task.Delay(100).ConfigureAwait(false); return(filledCollection); })); A addedA = new A(); //Act filledCollection.Add(addedA); await readOnlyList.InitializedCollectionAsync.ConfigureAwait(false); //Assert StandardCheck(filledCollection, readOnlyList); }
public void MoveLongLastingTask_FilledCollectionAndNotAwaitingInitializationBeforeMovement_NoElements() { //Arrange ObservableCollection <A> filledCollection = FilledSourceCollection; DeferredWrappingObservableReadOnlyList <A> readOnlyList = new DeferredWrappingObservableReadOnlyList <A>( Task.Run(async() => { await Task.Delay(100).ConfigureAwait(false); return(filledCollection); })); int moveFromIndex = 1; int moveToIndex = 3; //Act filledCollection.Move(moveFromIndex, moveToIndex); //Assert UninitializedCheck(readOnlyList); }
public void ReplaceLongLastingTask_FilledCollectionAndNOtAwaitingInitializationBeforeReplacement_NoElements() { //Arrange ObservableCollection <A> filledCollection = FilledSourceCollection; DeferredWrappingObservableReadOnlyList <A> readOnlyList = new DeferredWrappingObservableReadOnlyList <A>( Task.Run(async() => { await Task.Delay(100).ConfigureAwait(false); return(filledCollection); })); A replacingA = new A(); int replaceIndex = 1; //Act filledCollection[replaceIndex] = replacingA; //Assert UninitializedCheck(readOnlyList); }
public void InsertionLongLastingTask_FilledCollectionAndNotAwaitingInitializationBeforeInsertion_NoElements() { //Arrange ObservableCollection <A> filledCollection = FilledSourceCollection; DeferredWrappingObservableReadOnlyList <A> readOnlyList = new DeferredWrappingObservableReadOnlyList <A>( Task.Run(async() => { await Task.Delay(100).ConfigureAwait(false); return(filledCollection); })); A insertedA = new A(); int insertIndex = 1; //Act filledCollection.Insert(insertIndex, insertedA); //Assert UninitializedCheck(readOnlyList); }
public async Task RemoveAtLongLastingTask_FilledCollectionAndAwaitingInitializationAfterRemoval_RemovedElementExcluded() { //Arrange ObservableCollection <A> filledCollection = FilledSourceCollection; DeferredWrappingObservableReadOnlyList <A> readOnlyList = new DeferredWrappingObservableReadOnlyList <A>( Task.Run(async() => { await Task.Delay(100).ConfigureAwait(false); return(filledCollection); })); int removedIndex = 1; //Act filledCollection.RemoveAt(removedIndex); await readOnlyList.InitializedCollectionAsync.ConfigureAwait(false); //Assert StandardCheck(filledCollection, readOnlyList); }
public async Task MoveLongLastingTask_FilledCollectionAndAwaitingInitializationBeforeMovement_MovedElementOnRightPosition() { //Arrange ObservableCollection <A> filledCollection = FilledSourceCollection; DeferredWrappingObservableReadOnlyList <A> readOnlyList = new DeferredWrappingObservableReadOnlyList <A>( Task.Run(async() => { await Task.Delay(100).ConfigureAwait(false); return(filledCollection); })); int moveFromIndex = 1; int moveToIndex = 3; //Act await readOnlyList.InitializedCollectionAsync.ConfigureAwait(false); filledCollection.Move(moveFromIndex, moveToIndex); //Assert StandardCheck(filledCollection, readOnlyList); }
public async Task ReplaceLongLastingTask_FilledCollectionAndAwaitingInitializationBeforeReplacement_IncludesReplacedElement() { //Arrange ObservableCollection <A> filledCollection = FilledSourceCollection; DeferredWrappingObservableReadOnlyList <A> readOnlyList = new DeferredWrappingObservableReadOnlyList <A>( Task.Run(async() => { await Task.Delay(100).ConfigureAwait(false); return(filledCollection); })); A replacingA = new A(); int replaceIndex = 1; //Act await readOnlyList.InitializedCollectionAsync.ConfigureAwait(false); filledCollection[replaceIndex] = replacingA; //Assert StandardCheck(filledCollection, readOnlyList); }