Contains() 공개 정적인 메소드

Asserts that collection contains actual as an item.
public static Contains ( IEnumerable collection, Object actual ) : void
collection IEnumerable IEnumerable of objects to be considered
actual Object Object to be found within collection
리턴 void
예제 #1
0
        private void AssertMethodWasLocated(MethodInfo expected, Matcher matcher, params Type[] typesToBuildCompositeTypeFrom)
        {
            IList <MethodInfo> matches = new CompositeType(typesToBuildCompositeTypeFrom)
                                         .GetMatchingMethods(matcher, false);

            CollectionAssert.Contains(matches, expected);
        }
예제 #2
0
        public void GetMovementsByDateRange_MustReturns_MovementsInRange()
        {
            Account account = new Account();

            Expense ex1 = new Expense(1, new DateTime(2013, 1, 1));               // skip
            Expense ex2 = new Expense(1, new DateTime(2013, 1, 10));              // keep
            Expense ex3 = new Expense(1, new DateTime(2013, 1, 15));              // keep
            Expense ex4 = new Expense(1, new DateTime(2013, 2, 1));               // keep
            Expense ex5 = new Expense(1, new DateTime(2013, 2, 10));              // keep
            Expense ex6 = new Expense(1, new DateTime(2013, 2, 12));              // skip

            var from = new DateTime(2013, 1, 10);
            var to   = new DateTime(2013, 2, 10);

            account.AddMovements(new List <IMovement>()
            {
                ex1, ex2, ex3, ex4, ex5, ex6
            });

            IEnumerable <IMovement> movements = account.GetMovementsByDateRange(from, to);

            CollectionAssert.Contains(movements, ex2);
            CollectionAssert.Contains(movements, ex3);
            CollectionAssert.Contains(movements, ex4);
            CollectionAssert.Contains(movements, ex5);
            CollectionAssert.DoesNotContain(movements, ex1);
            CollectionAssert.DoesNotContain(movements, ex6);
        }
예제 #3
0
        public void Add_IncomeOnAccount_MustBeAdded()
        {
            Account account = new Account();
            Income  income  = new Income(100, DateTime.Today);

            account.AddIncome(income);

            CollectionAssert.Contains(account.Movements, income);
        }
예제 #4
0
        public void Add_ExpenseOnAccount_MustBeAdded()
        {
            Account account = new Account();
            Expense ex      = new Expense(5, DateTime.Today);

            account.AddExpense(ex);

            CollectionAssert.Contains(account.Movements, ex);
        }
        public void TestEnabledNodes()
        {
            var shouldBeEnabled    = new ValidEnabledStatePropertyNode();
            var shouldNotBeEnabled = new DisabledStatePropertyNode();

            NodeCollection initializedNodes = Node.InitializedNodes;
            NodeCollection enabledNodes     = this.nodeSupervisor.FilterEnabledNodes(initializedNodes);

            CollectionAssert.Contains(enabledNodes, shouldBeEnabled);
            CollectionAssert.DoesNotContain(enabledNodes, shouldNotBeEnabled);
        }
예제 #6
0
        public void Income_MustContain_ValueAndTagsAndDescription()
        {
            var    today  = DateTime.Today;
            Income income = new Income("description", 100, today, "stipendio");

            Assert.AreEqual(100, income.AbsoluteValue);
            Assert.AreEqual(100, income.Value);
            Assert.AreEqual(today, income.Date);
            Assert.AreEqual("description", income.Description);
            CollectionAssert.Contains(income.Tags, "stipendio");
        }
예제 #7
0
        public void Expense_MustContain_ValueAndTagsAndDate()
        {
            var     today = DateTime.Today;
            Expense ex    = new Expense(5, today, "mangiare", "mensa");

            Assert.AreEqual(5, ex.AbsoluteValue);
            Assert.AreEqual(-5, ex.Value);
            Assert.AreEqual(today, ex.Date);
            CollectionAssert.Contains(ex.Tags, "mangiare");
            CollectionAssert.Contains(ex.Tags, "mensa");
        }
예제 #8
0
        public void GetMovementsByTag_MustReturns_TheTaggedMovements()
        {
            Account account = new Account();

            Expense ex      = new Expense(100, DateTime.Today, "mangiare");
            Expense ex2     = new Expense(10, DateTime.Today, "cellulare");
            Income  income  = new Income(1000, DateTime.Today, "stipendio");
            Income  income2 = new Income(25, DateTime.Today, "Cellulare");

            account.AddExpense(ex);
            account.AddExpense(ex2);
            account.AddIncome(income);
            account.AddIncome(income2);

            IEnumerable <IMovement> movements = account.GetMovementByTag("Cellulare");

            CollectionAssert.DoesNotContain(movements, ex);
            CollectionAssert.DoesNotContain(movements, income);
            CollectionAssert.Contains(movements, ex2);
            CollectionAssert.Contains(movements, income2);
        }