Rebel.Tests.Extensions.HiveModelCreationHelper.MockTypedEntity C# (CSharp) Method

MockTypedEntity() public static method

public static MockTypedEntity ( ) : TypedEntity
return TypedEntity
        public static TypedEntity MockTypedEntity()
        {
            return MockTypedEntity(false);
        }

Same methods

HiveModelCreationHelper::MockTypedEntity ( HiveId id ) : TypedEntity
HiveModelCreationHelper::MockTypedEntity ( bool assignIds ) : TypedEntity

Usage Example

        public static TypedEntity SetupTestData(Guid newGuid, Guid newGuidRedHerring, NhibernateTestSetupHelper repo)
        {
            var entity = HiveModelCreationHelper.MockTypedEntity();

            entity.Id = new HiveId(newGuid);
            entity.EntitySchema.Alias = "schema-alias1";

            var existingDef = entity.EntitySchema.AttributeDefinitions[0];
            var newDef      = HiveModelCreationHelper.CreateAttributeDefinition("aliasForQuerying", "", "", existingDef.AttributeType, existingDef.AttributeGroup, true);

            entity.EntitySchema.AttributeDefinitions.Add(newDef);
            entity.Attributes.Add(new TypedAttribute(newDef, "my-new-value"));

            entity.Attributes[1].DynamicValue = "not-on-red-herring";
            entity.Attributes[NodeNameAttributeDefinition.AliasValue].Values["UrlName"] = "my-test-route";

            var redHerringEntity = HiveModelCreationHelper.MockTypedEntity();

            redHerringEntity.Id = new HiveId(newGuidRedHerring);
            redHerringEntity.EntitySchema.Alias = "redherring-schema";

            using (var uow = repo.ProviderSetup.UnitFactory.Create())
            {
                uow.EntityRepository.AddOrUpdate(entity);
                uow.EntityRepository.AddOrUpdate(redHerringEntity);
                uow.Complete();
            }

            return(entity);
        }
All Usage Examples Of Rebel.Tests.Extensions.HiveModelCreationHelper::MockTypedEntity