示例#1
0
        public async Task Update_Entity_Schema_With_Kept_Name_PostgreSQL_Test()
        {
            // Arrange
            if (!_context.AllowPostgreSQL)
            {
                Assert.True(true);
                return;
            }
#pragma warning disable CA2000 // Dispose objects before losing scope
            EntitySchemaEFRepository entitySchemaRepository = new EntitySchemaEFRepository(_context.GetPostgreSQLContext());
#pragma warning restore CA2000 // Dispose objects before losing scope
            // Act
            EntitySchema entitySchemaTest = new EntitySchema
            {
                Id           = DataUtil.GenerateUniqueId(),
                AppId        = "abcd",
                DatabaseId   = "abcd",
                Name         = "name1",
                DisplayName  = "Name",
                EntityFields = new List <EntityField>
                {
                    new EntityField
                    {
                        Name        = "a",
                        DisplayName = "A",
                        FieldType   = "text"
                    }
                }
            };

            await entitySchemaRepository.AddAsync(entitySchemaTest);

            await entitySchemaRepository.UpsertEntitySchemasAsync(new List <EntitySchema>
            {
                entitySchemaTest
            }, _context.PostgreSqlDatabaseConnection.Id, true);

            entitySchemaRepository.Dispose();

            // Assert
            Assert.True(true);
        }
示例#2
0
        public async Task Get_One_Entity_Schema_By_DB_And_Name_PostgreSQL_Test()
        {
            // Arrange
            if (!_context.AllowPostgreSQL)
            {
                Assert.True(true);
                return;
            }
#pragma warning disable CA2000 // Dispose objects before losing scope
            EntitySchemaEFRepository entitySchemaRepository = new EntitySchemaEFRepository(_context.GetPostgreSQLContext());
#pragma warning restore CA2000 // Dispose objects before losing scope
            // Act
            EntitySchema entitySchemaTest = new EntitySchema
            {
                Id           = DataUtil.GenerateUniqueId(),
                AppId        = "abc",
                DatabaseId   = "abc",
                Name         = "name",
                DisplayName  = "Name",
                EntityFields = new List <EntityField>
                {
                    new EntityField
                    {
                        Name        = "a",
                        DisplayName = "A",
                        FieldType   = "text"
                    }
                }
            };

            await entitySchemaRepository.AddAsync(entitySchemaTest);

            EntitySchema result = await entitySchemaRepository.GetOneEntitySchemaAsync("abc", "name");

            entitySchemaRepository.Dispose();
            // Assert
            Assert.NotNull(result);
        }