Beispiel #1
0
        public async void Handle_ShouldCallMapCryptoCurrencyToCryptoCurrencyRawResponse()
        {
            //arrange
            var request = new Contract.Requests.CryptoCurrencyAddRequest()
            {
                Code = "BTC"
            };
            var command           = new Application.CQRS.Commands.AddCryptoCurrencyCommand(request);
            var newCryptoCurrency = new CryptoCurrency()
            {
                Code = command.Code
            };
            var response = new CryptoCurrency()
            {
                Code = command.Code
            };

            A.CallTo(() => _mapper.MapAddCryptoCurrencyCommandToCryptoCurrency(command)).Returns(newCryptoCurrency);
            A.CallTo(() => _cryptoCurrencyRepository.AddNewCryptoCurrencyAsync(newCryptoCurrency, default)).Returns(response);
            //act
            await _testee.Handle(command, default);

            //assert
            A.CallTo(() => _mapper.MapCryptoCurrencyToCryptoCurrencyRawResponse(response)).MustHaveHappenedOnceExactly();
        }
Beispiel #2
0
        public async void Handle_ShouldCallMapAddCryptoCurrencyCommandToCryptoCurrency()
        {
            //arrange
            var request = new Contract.Requests.CryptoCurrencyAddRequest()
            {
                Code = "BTC"
            };
            var command = new Application.CQRS.Commands.AddCryptoCurrencyCommand(request);

            //act
            await _testee.Handle(command, default);

            //assert
            A.CallTo(() => _mapper.MapAddCryptoCurrencyCommandToCryptoCurrency(command)).MustHaveHappenedOnceExactly();
        }