Exemplo n.º 1
0
        public async Task Run_ShouldTerminateExecutionWhenChangedFieldIsNotMedia()
        {
            var activity        = New <Monitor_For_New_Media_Posted_v1>();
            var activityContext = await ConfigureMonitorForNewMediaPosted(activity);

            var containerExecutionContext = FixtureData.FalseInstagramContainerExecutionContext();

            containerExecutionContext = await RunMonitorForNewMediaPosted(activity, activityContext, containerExecutionContext);

            var operationalStateCM = containerExecutionContext.PayloadStorage.CrateContentsOfType <OperationalStateCM>().Single();

            Assert.True(operationalStateCM.CurrentActivityResponse.Type == ActivityResponse.RequestTerminate.ToString(), "Monitor_For_New_Media_Posted_v1 doesn't terminate container execution when changed field doesn't contain media");
        }
Exemplo n.º 2
0
        public async Task Run_ShouldTerminateExecutionWhenItCantFindPost()
        {
            var instagramIntegrationService = new Mock <IInstagramIntegration>();

            instagramIntegrationService.Setup(x => x.GetPostById(It.IsAny <string>(), It.IsAny <string>())).ReturnsAsync(null);
            ObjectFactory.Container.Inject(typeof(IInstagramIntegration), instagramIntegrationService.Object);

            var activity        = New <Monitor_For_New_Media_Posted_v1>();
            var activityContext = await ConfigureMonitorForNewMediaPosted(activity);

            var containerExecutionContext = FixtureData.FalseInstagramContainerExecutionContext();

            containerExecutionContext = await RunMonitorForNewMediaPosted(activity, activityContext, containerExecutionContext);

            var operationalStateCM = containerExecutionContext.PayloadStorage.CrateContentsOfType <OperationalStateCM>().Single();

            Assert.True(operationalStateCM.CurrentActivityResponse.Type == ActivityResponse.RequestTerminate.ToString(), "Monitor_For_New_Media_Posted_v1 doesn't terminate container execution when activity can't find related post on instagram");
        }