private void ArrangeTestAccordingToItem(Item expectedItem) { _timeManager.GetCurrentTime().Returns(expectedItem.CreationTime); _guidGenerator.GenerateId().Returns(expectedItem.Id); _repository.AddItemAsync(ArgWrapper.IsItem(expectedItem)) .Returns(Task.FromResult(expectedItem)); }
private void ArrangeTestAccordingToItem(Item expectedItem, Item itemForUpdate) { _timeManager.GetCurrentTime().Returns(expectedItem.LastUpdateTime); _getItemService.GetItemAsync(itemForUpdate.Id).Returns(Task.FromResult(new RetrievedItem <Item>(itemForUpdate))); _repository .UpdateItemAsync(ArgWrapper.IsItem(expectedItem)) .Returns(Task.FromResult(expectedItem)); }
private static void ConfigureRepositoryAndTimeManager(IListRepository repository, ITimeManager timeManager, Item originalItem, Item expectedItem) { repository.UpdateItemAsync(Arg.Is <Item>(item => item.Id == originalItem.Id)) .Returns(result => Task.FromResult((Item)result[0])); repository.GetItemAsync(originalItem.Id).Returns(Task.FromResult(originalItem)); timeManager.GetCurrentTime().Returns(expectedItem.LastUpdateTime); }
private Item CreateUpdatedItem(Item existingItem, Item newItem) { var currentTime = _timeManager.GetCurrentTime(); return(new Item { Id = newItem.Id, Text = newItem.Text, CreationTime = existingItem.CreationTime, LastUpdateTime = currentTime }); }
private Item CreateItem(string text) { var currentTime = _timeManager.GetCurrentTime(); var id = _guidGenerator.GenerateId(); return(new Item { Id = id, Text = text, CreationTime = currentTime, LastUpdateTime = currentTime }); }