コード例 #1
0
        public void GetNewExchangeRate()
        {
            // Arrange
            const double expected = 5.25;

            _sut.ChangeExchangeRate(5.25);

            // Act
            var actual = _sut.ExchangeRate;

            // Assert
            Assert.AreEqual(expected, actual, "Ny valuta kurs");
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            var exchangeRate = ParseExchangeRate(CurrencyConverter.ExchangeRate);
            var exchange     = ParseExchange();
            var amount       = ParseAmount();

            CurrencyConverter.ChangeExchangeRate(exchangeRate);

            var exchangedAmount = exchange.StartsWith('k')
                ? CurrencyConverter.KrToEuro(amount)
                : CurrencyConverter.EuroToKr(amount);

            var exchangeType = exchange.StartsWith('k') ? "Euro" : "Kr.";

            Console.WriteLine($"Dit beløb efter veksling er: {exchangedAmount} {exchangeType}");
        }