Beispiel #1
0
 public void SutIsCommand(CurrencyUpdateCommand sut)
 {
     // Fixture setup
     // Exercise system
     // Verify outcome
     Assert.IsAssignableFrom <ICommand>(sut);
     // Teardown
 }
 public void SutIsCommand(CurrencyUpdateCommand sut)
 {
     // Fixture setup
     // Exercise system
     // Verify outcome
     Assert.IsAssignableFrom<ICommand>(sut);
     // Teardown
 }
 public void ExecuteWillUpdateCurrency([Frozen]Mock<Currency> currencyMock, CurrencyUpdateCommand sut)
 {
     // Fixture setup
     // Exercise system
     sut.Execute();
     // Verify outcome
     currencyMock.Verify(c => c.UpdateExchangeRate(sut.DestinationCode, sut.Rate));
     // Teardown
 }
 public void RateIsCorrect([Frozen]decimal expectedRate, CurrencyUpdateCommand sut)
 {
     // Fixture setup
     // Exercise system
     decimal result = sut.Rate;
     // Verify outcome
     Assert.Equal(expectedRate, result);
     // Teardown
 }
 public void DestinationCodeIsCorrect([Frozen]string expectedCode, CurrencyUpdateCommand sut)
 {
     // Fixture setup
     // Exercise system
     string result = sut.DestinationCode;
     // Verify outcome
     Assert.Equal(expectedCode, result);
     // Teardown
 }
 public void CurrencyIsCorrect([Frozen]Currency expectedCurrency, CurrencyUpdateCommand sut)
 {
     // Fixture setup
     // Exercise system
     Currency result = sut.Currency;
     // Verify outcome
     Assert.Equal(expectedCurrency, result);
     // Teardown
 }
Beispiel #7
0
 public void ExecuteWillUpdateCurrency([Frozen] Mock <Currency> currencyMock, CurrencyUpdateCommand sut)
 {
     // Fixture setup
     // Exercise system
     sut.Execute();
     // Verify outcome
     currencyMock.Verify(c => c.UpdateExchangeRate(sut.DestinationCode, sut.Rate));
     // Teardown
 }
Beispiel #8
0
        public void RateIsCorrect([Frozen] decimal expectedRate, CurrencyUpdateCommand sut)
        {
            // Fixture setup
            // Exercise system
            decimal result = sut.Rate;

            // Verify outcome
            Assert.Equal(expectedRate, result);
            // Teardown
        }
Beispiel #9
0
        public void DestinationCodeIsCorrect([Frozen] string expectedCode, CurrencyUpdateCommand sut)
        {
            // Fixture setup
            // Exercise system
            string result = sut.DestinationCode;

            // Verify outcome
            Assert.Equal(expectedCode, result);
            // Teardown
        }
Beispiel #10
0
        public void CurrencyIsCorrect([Frozen] Currency expectedCurrency, CurrencyUpdateCommand sut)
        {
            // Fixture setup
            // Exercise system
            Currency result = sut.Currency;

            // Verify outcome
            Assert.Equal(expectedCurrency, result);
            // Teardown
        }
Beispiel #11
0
        public Currency Update(CurrencyUpdateCommand command)
        {
            if (command.IsValid)
            {
                this.Name    = command.Name;
                this.IsoCode = command.IsoCode;
                base.AddEvent(new CurrencyUpdated {
                    AggregateRootId = Id, CommandJson = JsonConvert.SerializeObject(command)
                });
            }

            return(this);
        }
        public async Task <ICommandHandlerAggregateAnswer> HandleAsync(CurrencyUpdateCommand command)
        {
            var currency = await currencyRepository.Query(command.Id);

            var commandHandlerAnswer = new CommandHandlerAggregateAnswer
            {
                ValidationResult = this.updateValidationHandler.Validate <CurrencyUpdateCommand>(command)
            };

            if (commandHandlerAnswer.ValidationResult.IsValid)
            {
                commandHandlerAnswer.AggregateRoot =
                    currencyRepository.Update(currency.Update(command));
            }
            return(commandHandlerAnswer);
        }