Beispiel #1
0
        public void UpdateEntity(TDST_MockEntity entity)
        {
            // Doing nothing. Actually taking this action would result in a
            // non-null changeset that we're not prepared to test

            // this.EntityContext.MockEntities.Update(entity);
        }
Beispiel #2
0
        public void SubmitChanges()
        {
            TDST_DomainService domainService = this.CreateDomainService(DomainOperationType.Submit);

            TDST_MockEntity entity = new TDST_MockEntity {
                PartitionKey = "PK", RowKey = "1"
            };
            ChangeSet changeSet = new ChangeSet(new[] { new ChangeSetEntry(1, entity, null, DomainOperation.Update)
                                                        {
                                                            HasMemberChanges = true
                                                        } });

            Assert.IsTrue(domainService.Submit(changeSet),
                          "Batched changes should have been submitted successfully.");
        }
Beispiel #3
0
        public void SupportedQuery()
        {
            TDST_DomainService domainService = this.CreateDomainService(DomainOperationType.Query);

            IQueryable       query = new TDST_MockEntity[0].AsQueryable().Where(e => e.RowKey != "1");
            QueryDescription qd    = new QueryDescription(domainService.MockDescription.GetQueryMethod("GetEntities"), new object[0], false, query);

            IEnumerable <ValidationResult> validationErrors;
            int totalCount;

            IEnumerable entities = domainService.Query(qd, out validationErrors, out totalCount);

            Assert.IsNotNull(entities,
                             "Query result should not be null.");
            Assert.AreEqual(4, entities.Cast <TDST_MockEntity>().Count(),
                            "There should be 4 entities in the filtered collection.");
            Assert.AreEqual("5", entities.Cast <TDST_MockEntity>().Last().RowKey,
                            "The RowKey of the final entity should be 5.");
        }
Beispiel #4
0
        public void UnsupportedQuery()
        {
            TDST_DomainService domainService = this.CreateDomainService(DomainOperationType.Query);

            IQueryable       query = new TDST_MockEntity[0].AsQueryable().OrderByDescending(e => e.RowKey);
            QueryDescription qd    = new QueryDescription(domainService.MockDescription.GetQueryMethod("GetEntities"), new object[0], false, query);

            IEnumerable <ValidationResult> validationErrors;
            int totalCount;

            IEnumerable entities = domainService.Query(qd, out validationErrors, out totalCount);

            Assert.IsNotNull(entities,
                             "Query result should not be null.");
            Assert.AreEqual(5, entities.Cast <TDST_MockEntity>().Count(),
                            "There should be 5 entities in the filtered collection.");
            Assert.AreEqual("1", entities.Cast <TDST_MockEntity>().Last().RowKey,
                            "The RowKey of the final entity should be 1.");
            // Not an official contract, but the serializer requires entities to be pre-enumerated
            Assert.IsInstanceOfType(entities, typeof(TDST_MockEntity[]),
                                    "Entities should be a TDST_MockEntity[].");
        }