예제 #1
0
        public void Test_Root_Organizations()
        {
            var organizations          = TestOrganizationRepository.NewCollection();
            var organizationRepository = new Mock <IOrganizationRepository>();

            organizationRepository.Setup(x => x.Organizations)
            .Returns(organizations.AsQueryable());
            int totalRootOrganizations = organizations.Count(
                x => x.ParentId.Equals(0) &&
                x.StatusId.Equals((byte)Status.Approved));

            var r = (IEnumerable <Organization>) new OrganizationController(organizationRepository.Object).List(null).Model;

            Assert.AreEqual(totalRootOrganizations, r.Count());
        }
예제 #2
0
        public void Test_Organizations_For_Pos()
        {
            int parentId               = 2;
            var organizations          = TestOrganizationRepository.NewCollection();
            var organizationRepository = new Mock <IOrganizationRepository>();

            organizationRepository.Setup(x => x.Organizations)
            .Returns(organizations.AsQueryable());
            //organizationRepository.Setup(x => x.GetByParentId(parentId, false))
            //    .Returns(organizations.ToList());
            int totalRootOrganizations = organizations.Count(
                x => (x.ParentId.Equals(parentId) || x.Id.Equals(parentId)) &&
                x.StatusId.Equals((byte)Status.Approved));

            var r = (IEnumerable <Organization>) new OrganizationController(organizationRepository.Object).List(parentId).Model;

            Assert.AreEqual(totalRootOrganizations, r.Count());
        }