Exemplo n.º 1
0
        public void TryFindComponent_OtherType_NotFound()
        {
            var cachedComponent = new DependentComponentAlone();

            _cache.CacheDependent(cachedComponent);

            Assert.IsFalse(_cache.TryFind <DependentComponentChild>(out _));
        }
Exemplo n.º 2
0
        public void Cache_One_CanBeFound()
        {
            var cachedComponent = new DependentComponentAlone();

            _cache.CacheDependent(cachedComponent);

            Assert.IsTrue(_cache.TryFind <DependentComponentAlone>(out var retrievedComponent));
            Assert.AreEqual(cachedComponent, retrievedComponent);
        }
Exemplo n.º 3
0
        public void Count_EqualsToNumberOfDistinctObjects(int expectedCount, int numberOfDuplicates)
        {
            for (var distinctObjectIndex = 0; distinctObjectIndex < expectedCount; distinctObjectIndex++)
            {
                var distinctObject = new DependentComponentAlone();

                for (var duplicateIndex = 0; duplicateIndex < numberOfDuplicates; duplicateIndex++)
                {
                    _cache.CacheDependent(distinctObject);
                }
            }

            Assert.AreEqual(expectedCount, _cache.Count);
        }