Exemplo n.º 1
0
        public async Task RemoveFromHistoryAsync_should_remove_if_exists()
        {
            const string repoToDelete = "path to delete";
            var          history      = new List <Repository>
            {
                new Repository("path1"),
                new Repository(repoToDelete),
                new Repository("path3"),
                new Repository("path4"),
                new Repository("path5"),
            };

            _repositoryStorage.Load(Key).Returns(x => history);

            var newHistory = await _manager.RemoveFromHistoryAsync(repoToDelete);

            newHistory.Count.Should().Be(4);
            newHistory.Should().NotContain(repoToDelete);

            _repositoryStorage.Received(1).Load(Key);
            _repositoryStorage.Received(1).Save(Key, Arg.Is <IEnumerable <Repository> >(h => h.All(r => r.Path != repoToDelete)));
        }