public void ContainmentCheckCanBeDoneOnBothKeyOrValue()
 {
     testSet.Add(1, "a");
     Assert.True(testSet.Contains(1));
     Assert.True(testSet.Contains("a"));
     Assert.False(testSet.Contains("b"));
     Assert.False(testSet.Contains(2));
     testSet.Clear();
 }
Esempio n. 2
0
        private void InitializeCollections()
        {
            batteries = new SecureSortedSet <uint, Battery>();

            BatteriesWithNoDrones = new SecureSortedSet <uint, Battery>((x, y) => (x.Charge <= y.Charge) ? -1 : 1)
            {
                MemberCondition = (obj) => batteries.Contains(obj) && !obj.HasDrone()
            };
            drones = new SecureSortedSet <uint, IDataSource>
            {
                MemberCondition = (obj) => obj is Drone
            };
            DronesWithNoJobs = new SecureSortedSet <uint, Drone>
            {
                MemberCondition = (drone) => drones.Contains(drone) && drone.GetJob() == null
            };
            incompleteJobs = new SecureSortedSet <uint, IDataSource>
            {
                MemberCondition = (item) => item is Job && ((Job)item).Status != JobStatus.Complete
            };
            completedJobs = new SecureSortedSet <uint, IDataSource>
            {
                MemberCondition = (item) => item is Job
            };
        }
Esempio n. 3
0
        private void InitializeCollections()
        {
            deploymentQueue = new Queue <Drone>();
            batteries       = new SecureSortedSet <uint, Battery>();

            freeBatteries = new SecureSortedSet <uint, Battery>((x, y) => (x.Charge <= y.Charge) ? -1 : 1)
            {
                MemberCondition = (Battery obj) => { return(batteries.Contains(obj) && obj.GetDrone() == null); }
            };
            chargingBatteries = new SecureSortedSet <uint, Battery>((x, y) => (x.Charge <= y.Charge) ? -1 : 1)
            {
                MemberCondition = (Battery obj) => { return(batteries.Contains(obj)); }
            };
            drones = new SecureSortedSet <uint, IDataSource>
            {
                MemberCondition = (obj) => { return(obj is Drone); }
            };
            freeDrones = new SecureSortedSet <uint, Drone>
            {
                MemberCondition = (drone) => { return(drones.Contains(drone) && drone.GetJob() == null); }
            };
        }