Example #1
0
        public void SharedStaticsTestSimple()
        {
            var sharedStatic1 = SharedStatic <int> .GetOrCreate <MiscTests, TestSimpleContext>();

            sharedStatic1.Data = 5;
            var sharedStatic2 = SharedStatic <int> .GetOrCreate <MiscTests, TestSimpleContext>();

            Assert.AreEqual(sharedStatic1.Data, sharedStatic2.Data);
            var sharedStatic3 = SharedStatic <int> .GetOrCreate <MiscTests, TestDifferentContext>();

            Assert.AreNotEqual(sharedStatic1.Data, sharedStatic3.Data);
        }
Example #2
0
        public void SharedStaticsTestInvalidSize()
        {
            var sharedStatic1 = SharedStatic <int> .GetOrCreate <MiscTests, TestInvalidSizeContext>();

            // This allocation should fail as we don't allow to reallocate with a different (bigger) size for the same key
            var exception = Assert.Throws <InvalidOperationException>(() => SharedStatic <long> .GetOrCreate <MiscTests, TestInvalidSizeContext>());

            StringAssert.Contains("Unable to create a SharedStatic", exception.Message);
            // This allocation should fail as we don't allow to reallocate with a different (smaller) size for the same key
            exception = Assert.Throws <InvalidOperationException>(() => SharedStatic <short> .GetOrCreate <MiscTests, TestInvalidSizeContext>());
            StringAssert.Contains("Unable to create a SharedStatic", exception.Message);
        }
Example #3
0
 public void Execute()
 {
     var sharedStatic3 = SharedStatic <int> .GetOrCreate(typeof(double), typeof(int));
 }
Example #4
0
 public void Execute()
 {
     var sharedStatic2 = SharedStatic <SharedStaticUnmanaged> .GetOrCreate <float, double>();
 }
Example #5
0
 public void Execute()
 {
     var sharedStatic1 = SharedStatic <SharedStaticMixed> .GetOrCreate <double>();
 }
Example #6
0
        public void Execute()
        {
            var sharedStatic3 = SharedStatic <int> .GetOrCreate(myDoubleType, myIntType);

            F();
        }
Example #7
0
 public void Execute()
 {
     var sharedStatic0 = SharedStatic <int> .GetOrCreate(myDoubleType);
 }
Example #8
0
 static EntitySerializerComponent()
 {
     s_SharedData = SharedStatic <TSharedData> .GetOrCreate <SharedKey>().UnsafeDataPointer;
 }