Advertisement
N1K003

Untitled

Apr 18th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1.         public void CanAddCurrency()
  2.         {
  3.             var mock = new Mock<ICurrencyRepository>();
  4.             mock.Setup(c => c.GetCurrencies()).Returns(new List<Currency>
  5.             {
  6.                 new Currency {Id = 1, Name="USD", ShortName = "United States Dollar", Symbol = "$"},
  7.             });
  8.  
  9.             var currency1 = new Currency { Id = 2, Name = "ETH", ShortName = "Ethereum", Symbol = "Ξ" };
  10.             var currency2 = new Currency { Id = 3, Name = "BTC", ShortName = "Bitcoin", Symbol = "฿" };
  11.  
  12.             mock.Object.RegisterNewCurrency(currency1);
  13.             mock.Object.RegisterNewCurrency(currency2);
  14.  
  15.             var list = mock.Object.GetCurrencies();
  16.  
  17.             Assert.AreEqual(list.Count, 3);
  18.             Assert.AreEqual(list[1].Id, currency1.Id);
  19.             Assert.AreEqual(list[2].Id, currency2.Id);
  20.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement