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); }
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); }
public void Execute() { var sharedStatic3 = SharedStatic <int> .GetOrCreate(typeof(double), typeof(int)); }
public void Execute() { var sharedStatic2 = SharedStatic <SharedStaticUnmanaged> .GetOrCreate <float, double>(); }
public void Execute() { var sharedStatic1 = SharedStatic <SharedStaticMixed> .GetOrCreate <double>(); }
public void Execute() { var sharedStatic3 = SharedStatic <int> .GetOrCreate(myDoubleType, myIntType); F(); }
public void Execute() { var sharedStatic0 = SharedStatic <int> .GetOrCreate(myDoubleType); }
static EntitySerializerComponent() { s_SharedData = SharedStatic <TSharedData> .GetOrCreate <SharedKey>().UnsafeDataPointer; }