Beispiel #1
0
        public async Task GetSingleWithCancellationInvokesGetSingleFromRepo()
        {
            // arrange
            var repoMock = GetRepositoryMock();
            var sut      = new MockCrudAggregate(repoMock.Object);

            // act
            _ = await sut.GetSingleAsync(Guid.NewGuid(), new CancellationTokenSource().Token);

            // assert
            repoMock.Verify(repo => repo.GetSingleAsync(It.IsAny <Guid>(), It.IsAny <CancellationToken>()), Times.Once);
        }
Beispiel #2
0
        public async Task GetAllInvokesGetAllFromRepo()
        {
            // arrange
            var repoMock = GetRepositoryMock();
            var sut      = new MockCrudAggregate(repoMock.Object);

            // act
            _ = await sut.GetAllAsync();

            // assert
            repoMock.Verify(repo => repo.GetAllAsync(It.IsAny <CancellationToken>()), Times.Once);
        }
Beispiel #3
0
        public async Task UpdateWithCancellationInvokesUpdateFromRepo()
        {
            // arrange
            var repoMock = GetRepositoryMock();
            var sut      = new MockCrudAggregate(repoMock.Object);

            // act
            _ = await sut.UpdateAsync(new BizTypeMock(), new CancellationTokenSource().Token);

            // assert
            repoMock.Verify(repo => repo.UpdateAsync(It.IsAny <BizTypeMock>(), It.IsAny <CancellationToken>()), Times.Once);
        }
Beispiel #4
0
        public async Task ExistsInvokesExistsFromRepo()
        {
            // arrange
            var repoMock = GetRepositoryMock();
            var sut      = new MockCrudAggregate(repoMock.Object);

            // act
            await sut.ExistsAsync(Guid.NewGuid());

            // assert
            repoMock.Verify(repo => repo.ExistsAsync(It.IsAny <Guid>(), It.IsAny <CancellationToken>()), Times.Once);
        }
Beispiel #5
0
        public async Task AddInvokesAddFromRepo()
        {
            // arrange
            var repoMock = GetRepositoryMock();
            var sut      = new MockCrudAggregate(repoMock.Object);

            // act
            _ = await sut.AddAsync(new BizTypeMock());

            // assert
            repoMock.Verify(repo => repo.AddAsync(It.IsAny <BizTypeMock>(), It.IsAny <CancellationToken>()), Times.Once);
        }