Exemplo n.º 1
0
        public async Task ThenItShouldReturnAcceptedResult(SyncEntityEvent <LearningProvider> @event)
        {
            var request = HttpRequestBuilder
                          .CreateHttpRequest()
                          .WithJsonBody(@event);

            var actual = await _function.RunAsync(request, EntityNameTranslator.LearningProviderPlural, "anything", _cancellationToken);

            Assert.IsInstanceOf <AcceptedResult>(actual);
        }
Exemplo n.º 2
0
        public async Task ThenItShouldReturnBadRequestResultIfEntityTypeInvalid()
        {
            var request = HttpRequestBuilder
                          .CreateHttpRequest()
                          .WithJsonBody(new SyncEntityEvent <LearningProvider>());

            var actual = await _function.RunAsync(request, "bad-type", "anything", _cancellationToken);

            Assert.IsInstanceOf <BadRequestResult>(actual);
        }
Exemplo n.º 3
0
        public async Task ThenItShouldSetExecutionContext(SyncEntityEvent <LearningProvider> @event)
        {
            var request = (HttpRequest)HttpRequestBuilder
                          .CreateHttpRequest()
                          .WithJsonBody(@event);

            await _function.RunAsync(request, EntityNameTranslator.LearningProviderPlural, "anything", _cancellationToken);

            _executionContextManagerMock.Verify(c => c.SetContext(request.Headers),
                                                Times.Once);
        }
Exemplo n.º 4
0
        public async Task ThenItShouldSyncUsingTheDeserialisedManagementGroupEvent(SyncEntityEvent <ManagementGroup> @event, string sourceSystemName)
        {
            var request = HttpRequestBuilder
                          .CreateHttpRequest()
                          .WithJsonBody(@event);

            await _function.RunAsync(request, EntityNameTranslator.ManagementGroupPlural, sourceSystemName, _cancellationToken);

            _syncManagerMock.Verify(m => m.ReceiveSyncEntityAsync(
                                        It.Is <SyncEntityEvent <ManagementGroup> >(actual => ObjectAssert.AreEqual(@event, actual)),
                                        sourceSystemName,
                                        _cancellationToken),
                                    Times.Once);
        }