예제 #1
0
        public void FilterOnInvalidEntityTypeJournal()
        {
            var result = new DeletedEntitiesProxy().GetDeletedEntities(entityType: "aaaa");

            Assert.False(result.IsSuccessfull, "Filter on invalid entity type should not have succeded");
            Assert.Null(result.DataObject);
        }
예제 #2
0
        public void FilterOnEntityTypePurchase()
        {
            var result = new DeletedEntitiesProxy().GetDeletedEntities(entityType: "Purchase");

            Assert.True(result.DataObject != null, "Error with response object");
            Assert.True(result.DataObject.Entities != null, "Error with response object entity collection");
            Assert.Null(result.DataObject.Entities.SingleOrDefault(e => e.EntityType != "Purchase"));
        }
예제 #3
0
        public void FilterOnEntityTypePurchase()
        {
            var result = new DeletedEntitiesProxy().GetDeletedEntities(entityType: "Purchase");

            Assert.NotNull(result.DataObject, "Error with response object");
            Assert.NotNull(result.DataObject.Entities, "Error with response object entity collection");
            Assert.IsNull(result.DataObject.Entities.SingleOrDefault(e => e.EntityType != "Purchase"), "Non-purchase entity type in result set");
        }
예제 #4
0
        public void GetAllNoFilters()
        {
            var result = new DeletedEntitiesProxy().GetDeletedEntities();

            Assert.True(result.DataObject != null, "Error with response object");
            Assert.True(result.DataObject.Entities != null, "Error with response object entity collection");

            Assert.Null(result.DataObject.Entities.SingleOrDefault(e => _allNotDeleted.Contains(e.EntityId)));
        }
예제 #5
0
        public void GetAllNoFilters()
        {
            var result = new DeletedEntitiesProxy().GetDeletedEntities();

            Assert.NotNull(result.DataObject, "Error with response object");
            Assert.NotNull(result.DataObject.Entities, "Error with response object entity collection");

            Assert.IsNull(result.DataObject.Entities.SingleOrDefault(e => _allNotDeleted.Contains(e.EntityId)), "Not deleted transactions contained in result set");
        }
예제 #6
0
        public void FilterOnUtcDeletedDateTime()
        {
            var fromDate = DateTime.UtcNow.AddHours(-1);
            var toDate   = DateTime.UtcNow;
            var result   = new DeletedEntitiesProxy().GetDeletedEntities(utcDeletedFromDate: fromDate, utcDeletedToDate: toDate);

            Assert.True(result.DataObject != null, "Error with response object");
            Assert.True(result.DataObject.Entities != null, "Error with response object entity collection");
            Assert.Null(result.DataObject.Entities.SingleOrDefault(e => e.Timestamp <fromDate || e.Timestamp> toDate));
        }
예제 #7
0
        public void FilterOnUtcDeletedDateTime()
        {
            var fromDate = DateTime.UtcNow.AddHours(-1);
            var toDate   = DateTime.UtcNow;
            var result   = new DeletedEntitiesProxy().GetDeletedEntities(utcDeletedFromDate: fromDate, utcDeletedToDate: toDate);

            Assert.NotNull(result.DataObject, "Error with response object");
            Assert.NotNull(result.DataObject.Entities, "Error with response object entity collection");
            Assert.IsNull(result.DataObject.Entities.SingleOrDefault(e => e.Timestamp <fromDate || e.Timestamp> toDate), "Entity outside of specified deleted times was returned");
        }
예제 #8
0
        public void TestPaging()
        {
            var proxy  = new DeletedEntitiesProxy();
            var result = proxy.GetDeletedEntities(pageNumber: 1, pageSize: 3);

            Assert.True(result.DataObject != null, "Error with response object");
            Assert.True(result.DataObject.Entities != null, "Error with response object entity collection");
            Assert.True(result.DataObject.Entities.Count == 3);

            var idsFromResult = new List <int>
            {
                result.DataObject.Entities[0].EntityId,
                result.DataObject.Entities[1].EntityId,
                result.DataObject.Entities[2].EntityId
            };

            result = proxy.GetDeletedEntities(pageNumber: 2, pageSize: 3);
            Assert.True(result.DataObject != null, "Error with response object, second request");
            Assert.True(result.DataObject.Entities != null, "Error with response object entity collection, second request");

            result.DataObject.Entities.ForEach(e => Assert.False(idsFromResult.Contains(e.EntityId), "Entity from first page also contained in second"));
        }