Пример #1
0
        private void SetupAndRunTest(BsonDocument shared, BsonDocument test)
        {
            if (test.Contains(SkipReasonKey))
            {
                throw new SkipException(test[SkipReasonKey].AsString);
            }

            Ensure.IsNotNullOrEmpty(DatabaseNameKey, nameof(DatabaseNameKey));
            Ensure.IsNotNullOrEmpty(CollectionNameKey, nameof(CollectionNameKey));

            JsonDrivenHelper.EnsureAllFieldsAreValid(shared, ExpectedSharedColumns);
            JsonDrivenHelper.EnsureAllFieldsAreValid(test, ExpectedTestColumns);
            CustomDataValidation(shared, test);

            DatabaseName   = shared[DatabaseNameKey].AsString;
            CollectionName = shared[CollectionNameKey].AsString;

            TestInitialize();
            DropCollection();
            CreateCollection();
            InsertData(shared);

            using (ConfigureFailPoint(test))
            {
                EventCapturer eventCapturer = null;
                if (ShouldEventsBeChecked)
                {
                    eventCapturer = new EventCapturer().Capture <CommandStartedEvent>(e => !DefaultCommandsToNotCapture.Contains(e.CommandName));
                }

                RunTest(shared, test, eventCapturer);
                if (ShouldEventsBeChecked)
                {
                    AssertEvents(eventCapturer, test);
                }

                AssertOutcome(test);
            }
        }
 public OperationTestRunner()
 {
     DefaultCommandsToNotCapture.Add("find");
 }
 protected virtual EventCapturer InitializeEventCapturer(EventCapturer eventCapturer)
 {
     return(eventCapturer.Capture <CommandStartedEvent>(e => !DefaultCommandsToNotCapture.Contains(e.CommandName)));
 }
 public OperationTestRunner(ITestOutputHelper testOutputHelper)
     : base(testOutputHelper)
 {
     DefaultCommandsToNotCapture.Add("find");
 }