MbUnit Icarus самоуничтожается в этом тесте

Я пытаюсь протестировать многопоточный класс ввода-вывода с помощью MbUnit. Моя цель состоит в том, чтобы конструктор тестового прибора выполнялся 3 раза, по одному для каждой строки в классе. Затем для каждого экземпляра выполните тесты несколько раз в параллельных потоках.

Однако Икарус взрывается с "индексом вне допустимого диапазона" на TaskRunner. Я не могу получить полный стек, окна сообщений появляются слишком быстро.

Что я делаю не так, или это ошибка в MbUnit / Gallio?

using System;
using System.Collections.Generic;
using System.Text;
using Gallio.Framework;
using MbUnit.Framework;
using MbUnit.Framework.ContractVerifiers;
using System.IO;

namespace ImageResizer.Plugins.DiskCache.Tests {
    [TestFixture]
    [Row(0,50,false)]
    [Row(0,50,true)]
    [Row(8000,100,true)]
    public class CustomDiskCacheTest {

        public CustomDiskCacheTest(int subfolders, int totalFiles, bool hashModifiedDate) {
            char c = System.IO.Path.DirectorySeparatorChar;
            string folder = System.IO.Path.GetTempPath().TrimEnd(c) + c + System.IO.Path.GetRandomFileName();
            cache = new CustomDiskCache(folder,subfolders,hashModifiedDate);
            this.quantity = totalFiles;

            for (int i = 0; i < quantity;i++){
                cache.GetCachedFile(i.ToString(),"test",delegate(Stream s){
                    s.WriteByte(32); //Just one space
                },defaultDate, 10);
            }
        }
        int quantity;
        CustomDiskCache cache = null;
        DateTime defaultDate = new DateTime(2011, 1, 1);

        [ThreadedRepeat(150)]
        [Test(Order=1)]
        public void TestAccess() {
            CacheResult r = 
                cache.GetCachedFile(new Random().Next(0, quantity).ToString(), "test", 
                delegate(Stream s) { Assert.Fail("No files have been modified, this should not execute"); }, defaultDate, 100);

            Assert.IsTrue(System.IO.File.Exists(r.PhysicalPath));
            Assert.IsTrue(r.Result == CacheQueryResult.Hit);
        }

        volatile int seed = 0;
        [Test (Order=2)]
        [ThreadedRepeat(20)]
        public void TestUpdate() {
            //try to get a unique date time value
            DateTime newTime = DateTime.UtcNow.AddDays(seed++);
            CacheResult r =
                cache.GetCachedFile(new Random().Next(0, quantity).ToString(), "test",
                delegate(Stream s) {
                    s.WriteByte(32); //Just one space
                }, newTime, 100);

            Assert.AreEqual<DateTime>(newTime, System.IO.File.GetLastWriteTimeUtc(r.PhysicalPath));
            Assert.IsTrue(r.Result == CacheQueryResult.Miss);
        }


        [Test(Order=3)]
        public void TestClear() {
            System.IO.Directory.Delete(cache.PhysicalCachePath, true);
        }
    }
}
6
задан Lilith River 11 April 2011 в 23:29
поделиться