public void GetEnumerator_ThrowsIf_AnyJobsAreWriting()
        {
            var          shared          = new SharedArray <int>(4);
            TestDelegate enumerateAction = () => { foreach (var e in shared)
                                                   {
                                                   }
            };

            AssertSafety.ThrowsIfAnyScheduledWriters(shared, enumerateAction);
            // it's fine if other things are reading while we enumerate, because enumerating returns copies of structs,
            // so the source data won't be changed by the enumerator
            AssertSafety.DoesNotThrowIfAnyScheduledReaders(shared, enumerateAction);
        }
        public void Dispose_ThrowsIf_AnyJobsAreUsingData()
        {
            var shared = new SharedArray <int>(new[] { 3, 0, 3, 0 });

            AssertSafety.ThrowsIfAnyDataUsers_SingleCall(shared, shared.Dispose);
        }
        public void ImplicitCastToManagedArray_ThrowsIf_AnyJobsAreUsingData()
        {
            var shared = new SharedArray <double>(4);

            AssertSafety.ThrowsIfAnyJobsAreUsingData(shared, () => { double[] asManaged = shared; });
        }
        public void Clear_ThrowsIf_AnyJobsAreUsingData()
        {
            var shared = new SharedArray <int>(new[] { 6, 9, 4, 2 });

            AssertSafety.ThrowsIfAnyJobsAreUsingData(shared, shared.Clear);
        }
        public void Resize_ThrowsIf_AnyJobsAreUsingData()
        {
            var shared = new SharedArray <Vector2>(4);

            AssertSafety.ThrowsIfAnyDataUsers_SingleCall(shared, () => shared.Resize(8));
        }