Esempio n. 1
0
            public static void ThisTestClassInitialize(TestContext context)
            {
                // quieting intermittent code analysis warning
                TestHelp.DoNothing(context);

                target = new NonRecursiveLock();
            }
 public DisposableClassWithDictionaryStringString()
 {
     _myDictionary = new Dictionary <string, string> {
         { "A Key", "A Value" }
     };
     TestHelp.DoNothing(_myDictionary);
 }
            protected override void ArrangeMethod()
            {
                traceLines = new List <string>();

                memoryStream = DisposableHelper.SafeCreate(
                    () =>
                {
                    var rv      = DisposableHelper.SafeCreate(() => new MemoryStream());
                    rv.Capacity = 1024 * 1024;
                    rv.Position = 0;
                    return(rv);
                });
                var streamWriter = new StreamWriter(memoryStream)
                {
                    AutoFlush = true
                };

                memoryListener = new TextWriterTraceListener(streamWriter);
                Trace.Listeners.Add(memoryListener);

                source = new EventSource();

                removedInstanceSink = new EventSink(source);
                removedInstanceId   = removedInstanceSink.Id;
                TestHelp.DoNothing(removedInstanceSink);

                keptInstanceSink = new EventSink(source);
                keptInstanceId   = keptInstanceSink.Id;
                TestHelp.DoNothing(keptInstanceSink);
            }
Esempio n. 4
0
            public void It_should_throw_on_WaitingWriteCount()
            {
                object ignored = null;

                Action throwingAction = () => ignored = TargetDiagnostic.WaitingWriteCount;
                var    e = throwingAction.Should().Throw <ObjectDisposedException>();

                e.WithMessage("*Cannot access a disposed object.*");
                e.WithMessage("*NonRecursiveLock*");

                TestHelp.DoNothing(ignored);
            }
Esempio n. 5
0
        public static void AssemblyInitialize(TestContext context)
        {
            // quieting intermittent code analysis warning
            TestHelp.DoNothing(context);

            // acquire assemblies under test
            var assemblies = ImmutableHashSet <Assembly> .Empty.ToBuilder();

            // Landorphan.Common
            assemblies.Add(typeof(DisposableHelper).Assembly);

            AssembliesUnderTest = assemblies.ToImmutable();
        }
 public void SetFlatField(IDisposable value)
 {
     flatField = value;
     TestHelp.DoNothing(flatField);
 }
 public void SetAnotherField(IDisposable value)
 {
     anotherField = value;
     TestHelp.DoNothing(anotherField);
 }