示例#1
0
        public void GetQuote_bycurrency_valid()
        {
            // MOCK

            var quotes = new List <Quote> {
                new Quote {
                    Currency = "usd"
                },
                new Quote {
                    Currency = "can"
                },
                new Quote {
                    Currency = "usd"
                }
            };

            _quoteRepository.GetQuotes().Returns(quotes);

            // Execute

            var filter = new QuotesFilter();

            filter.AddFilterByCurrency("usd");

            var result = _sut.GetQuotes().ToList();

            result = _sut.FilterQuotes(result, filter).ToList();

            // Assert

            Assert.AreEqual(2, result.Count);
            Assert.AreEqual(0, result.Count(x => x.Currency == "can"));
            Assert.IsTrue(result.Count == 2);
        }