Example #1
0
        public async Task use_type_filters()
        {
            NumberOfStreams = 10;
            await PublishSingleThreaded();

            using var fetcher1 = new EventFetcher(theStore, theStore.Tenancy.Default.Database, new ISqlFragment[0]);

            var shardName = new ShardName("name");
            var range1    = new EventRange(shardName, 0, NumberOfEvents);
            await fetcher1.Load(range1, CancellationToken.None);

            var uniqueTypeCount = range1.Events.Select(x => x.EventType).Distinct()
                                  .Count();

            uniqueTypeCount.ShouldBe(5);

            var filter = new EventTypeFilter(theStore.Events, new Type[] { typeof(Travel), typeof(Arrival) });

            using var fetcher2 = new EventFetcher(theStore, theStore.Tenancy.Default.Database, new ISqlFragment[] { filter });

            var range2 = new EventRange(shardName, 0, NumberOfEvents);
            await fetcher2.Load(range2, CancellationToken.None);

            range2.Events
            .Select(x => x.EventType)
            .OrderBy(x => x.Name).Distinct()
            .ShouldHaveTheSameElementsAs(typeof(Arrival), typeof(Travel));
        }
        internal async Task executeAfterLoadingEvents(Action <IEventStore> loadEvents)
        {
            loadEvents(theSession.Events);
            await theSession.SaveChangesAsync();

            var fetcher = new EventFetcher(theStore, theStore.Tenancy.Default.Database, theFilters.ToArray());
            await fetcher.Load(theRange, default);
        }
Example #3
0
        public override void Given()
        {
            base.Given();

            EventFetcher.Setup(x => x.Fetch(It.IsAny <CancellationToken>())).Returns(() => Task.FromResult <IEnumerable <EpcisEvent> >(new[] { new EpcisEvent(), new EpcisEvent() }));
            Parameters.Add(new Model.Queries.QueryParameter {
                Name = "maxEventCount", Values = new[] { "1" }
            });
        }
        public async Task event_fetcher_simple_case()
        {
            using var fetcher = new EventFetcher(theStore, new ISqlFragment[0]);

            NumberOfStreams = 10;
            await PublishSingleThreaded();

            var range1 = new EventRange(new ShardName("name"), 0, 10);
            await fetcher.Load(range1, CancellationToken.None);

            var range2 = new EventRange(new ShardName("name"), 10, 20);
            await fetcher.Load(range2, CancellationToken.None);

            var range3 = new EventRange(new ShardName("name"), 20, 38);
            await fetcher.Load(range3, CancellationToken.None);

            range1.Events.Count.ShouldBe(10);
            range2.Events.Count.ShouldBe(10);
            range3.Events.Count.ShouldBe(18);
        }
Example #5
0
        public async void Execute(object parameter)
        {
            var app = App.PublicClientApp;

            InteractiveAuthenticationProvider authProvider = new InteractiveAuthenticationProvider(app, new string[] { "Calendars.Read" });

            GraphServiceClient graphClient = new GraphServiceClient(authProvider);

            EventFetcher            eventFetcher = new EventFetcher(graphClient);
            IEnumerable <WorkEntry> events       = new List <WorkEntry>();

            try
            {
                events = await eventFetcher.GetDaysEventsAsync(_dataContext.TodayDate);
            }
            catch { }

            _dataContext.WorkEntries = new ObservableCollection <WorkEntry>(_dataContext.WorkEntries.Where(x => x.Source != "Outlook"));

            foreach (var item in events)
            {
                _dataContext.WorkEntries.Add(item);
            }
        }
Example #6
0
 public void ItShouldCallTheEventFetcherApplyMethodWithSimpleParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <SimpleParameterFilter <int> >(f => f.Field == EpcisField.RequestId && f.Values.Any(v => v == 6))), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithSimpleParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <SimpleParameterFilter <string> >(f => f.Field == EpcisField.TransformationId && f.Values.Any(v => v.ToString() == "test_trID"))), Times.Once);
 }
Example #8
0
 public void ItShouldCallTheEventFetcherApplyMethodWithSourceDestinationFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <SourceDestinationFilter>(f => f.Type == SourceDestinationType.Source && f.Name == "sourceName" && f.Values.Any(v => v.ToString() == "test_source"))), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithComparisonCustomFieldParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <ComparisonCustomFieldFilter>(f => f.Field.Namespace == "namespace" && f.Field.Name == "name" && f.Comparator == FilterComparator.LessThan && f.IsInner == false && f.Value.ToString() == "15")), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithMatchEpcFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <MatchEpcFilter>(f => f.EpcType.Contains(EpcType.OutputEpc) && f.Values.Any(v => v.ToString() == "epc_value"))), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithExistsErrorDeclarationFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.IsAny <ExistsErrorDeclarationFilter>()), Times.Once);
 }
Example #12
0
 public void ItShouldCallTheEventFetcherApplyMethodWithSourceDestinationFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <ExistCustomFieldFilter>(f => f.IsInner == true && f.Field.Namespace == "namespaceInner" && f.Field.Name == "name" && f.Field.Type == FieldType.Ilmd)), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithOrderDirectionFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <OrderDirectionFilter>(f => f.Direction == OrderDirection.Ascending)), Times.Once);
 }
Example #14
0
 public void ItShouldCallTheEventFetcherApplyMethodWithMasterdataHierarchyFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <MasterdataHierarchyFilter>(f => f.Field == EpcisField.BusinessLocation && f.Values.Any(v => v.ToString() == "loc_id"))), Times.Once);
 }
Example #15
0
 public void ItShouldCallTheEventFetcherApplyMethodWithOrderFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <OrderFilter>(f => f.Field == EpcisField.BusinessLocation)), Times.Once);
 }
Example #16
0
 public void ItShouldCallTheEventFetcherApplyMethodWithSourceDestinationFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <QuantityFilter>(f => f.Operator == FilterComparator.LessThan && f.Value == 38)), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithComparisonParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <ComparisonParameterFilter>(f => f.Comparator == FilterComparator.GreaterOrEqual && f.Field == EpcisField.RecordTime && f.Value is DateTime)), Times.Once);
 }
Example #18
0
 public void ItShouldCallTheEventFetcherApplyMethodWithSourceDestinationFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <ComparisonCustomFieldFilter>(f => f.IsInner == false && f.Comparator == FilterComparator.LessOrEqual && f.Field.Namespace == "namespace" && f.Field.Name == "ilmd" && f.Field.Type == FieldType.Ilmd && (double)f.Value == 15)), Times.Once);
 }
Example #19
0
 public void ItShouldCallTheEventFetcherApplyMethodWithComparisonCustomFieldParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <AttributeFilter>(f => f.Field == EpcisField.BusinessLocation && f.AttributeName == "attributeName" && f.Values.Single() == "some value")), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithSourceDestinationFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <CustomFieldFilter>(f => f.IsInner == false && f.Field.Namespace == "namespace" && f.Field.Name == "ilmd" && f.Field.Type == FieldType.Ilmd && f.Values.Contains("expected"))), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithComparisonParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <SimpleParameterFilter <EventAction> >(f => f.Field == EpcisField.Action && f.Values.Any(v => v.ToString() == "ADD"))), Times.Once);
 }
Example #22
0
 public void ItShouldCallTheEventFetcherApplyMethodWithEqualsErrorReasonFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <EqualsErrorReasonFilter>(f => f.Values.Any(v => v.ToString() == "reason"))), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithSimpleParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <SimpleParameterFilter <EventType> >(f => f.Field == EpcisField.EventType && f.Values.Any(v => v.ToString() == "ObjectEvent"))), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithSimpleParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <SimpleParameterFilter <string> >(f => f.Field == EpcisField.ReadPoint && f.Values.Any(v => v.ToString() == "read_point"))), Times.Once);
 }
Example #25
0
 public void ItShouldCallTheEventFetcherApplyMethodWithEqualsCorrectiveEventIdFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <EqualsCorrectiveEventIdFilter>(f => f.Values.Any(v => v.ToString() == "evt_id"))), Times.Once);
 }
Example #26
0
 public void ItShouldCallTheEventFetcherApplyMethodWithComparisonParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <SimpleParameterFilter <string> >(f => f.Field == EpcisField.BusinessStep && f.Values.Any(v => v.ToString() == "urn:fastnt:demo:bizstep:demo:packing"))), Times.Once);
 }
Example #27
0
 public void ItShouldCallTheEventFetcherApplyMethodWithSourceDestinationFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <ComparisonCustomFieldFilter>(f => f.IsInner == true && f.Comparator == FilterComparator.GreaterThan && f.Field.Namespace == "namespace" && f.Field.Name == "ilmd" && f.Field.Type == FieldType.Ilmd && (DateTime)f.Value == new DateTime(2019, 08, 24, 10, 05, 02, DateTimeKind.Utc))), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithComparisonParameterFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <SimpleParameterFilter <string> >(f => f.Field == EpcisField.Disposition && f.Values.Any(v => v.ToString() == "urn:epcglobal:cbv:disp:loading"))), Times.Once);
 }
 public void ItShouldCallTheEventFetcherApplyMethodWithLimitFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <LimitFilter>(f => f.Value == 6)), Times.Once);
 }
Example #30
0
 public void ItShouldCallTheEventFetcherApplyMethodWithSourceDestinationFilter()
 {
     EventFetcher.Verify(x => x.Apply(It.Is <BusinessTransactionFilter>(f => f.TransactionType == "bizTransType" && f.Values.Any(v => v.ToString() == "test_biztrans"))), Times.Once);
 }