Exemple #1
0
#pragma warning disable CA1822 // method should be made static
        internal TestConfig GetTestConfig(string testClassName, string vcrSessionName, VcrSharp.VCRMode vcrMode = VcrSharp.VCRMode.Cache)
        {
            var vcrCassette = new FileInfo($"../../../.vcr/{testClassName}.{vcrSessionName}.yaml");

            // take care to use a small polling interval only when VCR is allowed to playback and we have a non-empty cassette
            // (i.e. when in Record only mode, the polling interval will be large)
            var vcrPlayback   = vcrMode == VcrSharp.VCRMode.Playback || vcrMode == VcrSharp.VCRMode.Cache;
            var pollFrequency = (vcrCassette.Exists && vcrCassette.Length > 0 && vcrPlayback) ?
                                TimeSpan.FromMilliseconds(1) :
                                Config.PollFrequencyTimeSpan;

            return(new TestConfig(vcrCassette.FullName, pollFrequency, vcrMode));
        }
Exemple #2
0
 public TestConfig(string vcrCassettePath, TimeSpan pollFrequency, VcrSharp.VCRMode vcrMode)
 {
     VcrCassettePath = vcrCassettePath;
     PollFrequency   = pollFrequency;
     VcrMode         = vcrMode;
 }