Example #1
0
        public void TestCannotViewContactUser()
        {
            var users = new List <User> {
                FakeUsers.GetContact()
            }.AsQueryable();
            var visibleUsers = users.CanViewUsers(FakeUsers.GetPrivate().AsModel());

            visibleUsers.Should().HaveCount(0);
        }
Example #2
0
        public void TestCanViewOwnHiddenActivity()
        {
            var activities = new List <Activity>
            {
                new Activity
                {
                    Id         = 1,
                    Visibility = Visibility.Hidden,
                    User       = FakeUsers.GetPrivate(),
                    UserId     = FakeUsers.GetPrivate().Id
                }
            }.AsQueryable();

            var visibleActivities = activities.CanViewContent(FakeUsers.GetPrivate().AsModel());

            visibleActivities.Should().HaveCount(1);
        }
Example #3
0
        public void TestCanViewOwnHiddenOrigin()
        {
            var origins = new List <Origin>
            {
                new Origin
                {
                    Id         = 1,
                    Visibility = Visibility.Hidden,
                    User       = FakeUsers.GetPrivate(),
                    UserId     = FakeUsers.GetPrivate().Id
                }
            }.AsQueryable();

            var visibleOrigins = origins.CanViewContent(FakeUsers.GetPrivate().AsModel());

            visibleOrigins.Should().HaveCount(1);
        }
Example #4
0
        public void TestCanViewOwnHiddenPlantInfo()
        {
            var plantInfos = new List <PlantInfo>
            {
                new PlantInfo
                {
                    Id         = 1,
                    Visibility = Visibility.Hidden,
                    User       = FakeUsers.GetPrivate(),
                    UserId     = FakeUsers.GetPrivate().Id
                }
            }.AsQueryable();

            var visiblePlantInfos = plantInfos.CanViewContent(FakeUsers.GetPrivate().AsModel());

            visiblePlantInfos.Should().HaveCount(1);
        }
Example #5
0
        public void TestCanViewOwnHiddenInventoryItem()
        {
            var inventoryItems = new List <InventoryItem>
            {
                new InventoryItem
                {
                    Id         = 1,
                    Visibility = Visibility.Hidden,
                    User       = FakeUsers.GetPrivate(),
                    UserId     = FakeUsers.GetPrivate().Id
                }
            }.AsQueryable();

            var visibleInventoryItems = inventoryItems.CanViewContent(FakeUsers.GetPrivate().AsModel());

            visibleInventoryItems.Should().HaveCount(1);
        }
        public void TestCanViewOwnHiddenSpecimen()
        {
            var specimens = new List <Specimen>
            {
                new Specimen
                {
                    Id            = 1,
                    InventoryItem = new InventoryItem
                    {
                        Id         = 1,
                        Visibility = Visibility.Hidden,
                        User       = FakeUsers.GetPrivate(),
                        UserId     = FakeUsers.GetPrivate().Id
                    }
                }
            }.AsQueryable();

            var visibleSpecimens = specimens.CanViewContent(FakeUsers.GetPrivate().AsModel());

            visibleSpecimens.Should().HaveCount(1);
        }