Exemple #1
0
        public async void Handle_Exception_Test()
        {
            this._unitOfUnitMock.Setup(mock => mock.OrganisationRepository.ReadAll()).Throws(new Exception());

            var command = new ReadAllOrganisationsCommand();
            var handler = new ReadAllOrganisationsHandler(this._unitOfUnitMock.Object);

            var result = await handler.Handle(command, new CancellationTokenSource().Token);

            Assert.False((bool)result);
        }
Exemple #2
0
        public async void Handle_Succes_Test()
        {
            List <Organisation> resultpre = new List <Organisation>();

            this._unitOfUnitMock.Setup(mock => mock.OrganisationRepository.ReadAll()).Returns(Task.FromResult(resultpre));

            var command = new ReadAllOrganisationsCommand();
            var handler = new ReadAllOrganisationsHandler(this._unitOfUnitMock.Object);

            var result = await handler.Handle(command, new CancellationTokenSource().Token);

            Assert.Equal(resultpre, result);
        }