コード例 #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));
        }
コード例 #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));
        }
コード例 #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);
        }