Пример #1
0
        public void TestSupportedObjects()
        {
            // 5MB byte[]
            object objectA = TestUtils.GetRandomBytesInArray(5 * 1024 * 1024);

            // string containing 5 * 1024 * 1024 chars (total size = 5 * 1024 * 1024 * sizeof(char))
            object objectB = new StringBuilder().Append('a', 5 * 1024 * 1024).ToString();

            using (SharedMemoryManager manager = new SharedMemoryManager(_loggerFactory, _mapAccessor))
            {
                Assert.True(manager.IsSupported(objectA));
                Assert.True(manager.IsSupported(objectB));
            }
        }
Пример #2
0
        public void TestUnsupportedObjects()
        {
            // Objects that don't meet the minimum size requirements
            object objectA = new byte[5];
            object objectB = new string("abc");

            // Objects that don't meet the type requirements
            object objectC = new int[5 * 1024 * 1024];

            using (SharedMemoryManager manager = new SharedMemoryManager(_loggerFactory, _mapAccessor))
            {
                Assert.False(manager.IsSupported(objectA));
                Assert.False(manager.IsSupported(objectB));
                Assert.False(manager.IsSupported(objectC));
            }
        }