Exemplo n.º 1
0
        public void TestSingle_not_data()
        {
            var employees = RepositoryFactory.GetEmployees();

            Assert.Throws <InvalidOperationException>(() =>
                                                      WithoutLinq.CashSingle(employees, a => a.Role == RoleType.Unknown));
            Assert.Throws <InvalidOperationException>(() => employees.CashSingle(a => a.Role == RoleType.Unknown));
        }
Exemplo n.º 2
0
        public void TestSingle_more_then_one_data()
        {
            var employees = RepositoryFactory.GetEmployees();

            Assert.Throws <InvalidOperationException>(() =>
                                                      WithoutLinq.CashSingle(employees, a => a.Role == RoleType.Engineer));
            Assert.Throws <InvalidOperationException>(() => employees.CashSingle(a => a.Role == RoleType.Engineer));
        }
Exemplo n.º 3
0
        public void TestSinge()
        {
            var employees = RepositoryFactory.GetEmployees();

            Assert.Equal(RoleType.Manager, WithoutLinq.CashSingle(employees, a => a.Role == RoleType.Manager).Role);

            Assert.Equal(RoleType.Manager, employees.CashSingle(a => a.Role == RoleType.Manager).Role);
        }