Пример #1
0
        private async Task <bool> BeUniqueByTenantIdOwnerIdEnvironmentIdVariableTemplateId(ApiTenantVariableRequestModel model, CancellationToken cancellationToken)
        {
            TenantVariable record = await this.tenantVariableRepository.ByTenantIdOwnerIdEnvironmentIdVariableTemplateId(model.TenantId, model.OwnerId, model.EnvironmentId, model.VariableTemplateId);

            if (record == null || (this.existingRecordId != default(string) && record.Id == this.existingRecordId))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        public async Task <ApiTenantVariableResponseModel> ByTenantIdOwnerIdEnvironmentIdVariableTemplateId(string tenantId, string ownerId, string environmentId, string variableTemplateId)
        {
            TenantVariable record = await this.tenantVariableRepository.ByTenantIdOwnerIdEnvironmentIdVariableTemplateId(tenantId, ownerId, environmentId, variableTemplateId);

            if (record == null)
            {
                return(null);
            }
            else
            {
                return(this.bolTenantVariableMapper.MapBOToModel(this.dalTenantVariableMapper.MapEFToBO(record)));
            }
        }
        public void MapEFToBOList()
        {
            var            mapper = new DALTenantVariableMapper();
            TenantVariable entity = new TenantVariable();

            entity.SetProperties("A", "A", "A", "A", "A", "A", "A");

            List <BOTenantVariable> response = mapper.MapEFToBO(new List <TenantVariable>()
            {
                entity
            });

            response.Count.Should().Be(1);
        }
Пример #4
0
        public virtual BOTenantVariable MapEFToBO(
            TenantVariable ef)
        {
            var bo = new BOTenantVariable();

            bo.SetProperties(
                ef.Id,
                ef.EnvironmentId,
                ef.JSON,
                ef.OwnerId,
                ef.RelatedDocumentId,
                ef.TenantId,
                ef.VariableTemplateId);
            return(bo);
        }
Пример #5
0
        public virtual TenantVariable MapBOToEF(
            BOTenantVariable bo)
        {
            TenantVariable efTenantVariable = new TenantVariable();

            efTenantVariable.SetProperties(
                bo.EnvironmentId,
                bo.Id,
                bo.JSON,
                bo.OwnerId,
                bo.RelatedDocumentId,
                bo.TenantId,
                bo.VariableTemplateId);
            return(efTenantVariable);
        }
        public async void Get()
        {
            var mock   = new ServiceMockFacade <ITenantVariableRepository>();
            var record = new TenantVariable();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult(record));
            var service = new TenantVariableService(mock.LoggerMock.Object,
                                                    mock.RepositoryMock.Object,
                                                    mock.ModelValidatorMockFactory.TenantVariableModelValidatorMock.Object,
                                                    mock.BOLMapperMockFactory.BOLTenantVariableMapperMock,
                                                    mock.DALMapperMockFactory.DALTenantVariableMapperMock);

            ApiTenantVariableResponseModel response = await service.Get(default(string));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <string>()));
        }
        public void MapEFToBO()
        {
            var            mapper = new DALTenantVariableMapper();
            TenantVariable entity = new TenantVariable();

            entity.SetProperties("A", "A", "A", "A", "A", "A", "A");

            BOTenantVariable response = mapper.MapEFToBO(entity);

            response.EnvironmentId.Should().Be("A");
            response.Id.Should().Be("A");
            response.JSON.Should().Be("A");
            response.OwnerId.Should().Be("A");
            response.RelatedDocumentId.Should().Be("A");
            response.TenantId.Should().Be("A");
            response.VariableTemplateId.Should().Be("A");
        }
        public void MapBOToEF()
        {
            var mapper = new DALTenantVariableMapper();
            var bo     = new BOTenantVariable();

            bo.SetProperties("A", "A", "A", "A", "A", "A", "A");

            TenantVariable response = mapper.MapBOToEF(bo);

            response.EnvironmentId.Should().Be("A");
            response.Id.Should().Be("A");
            response.JSON.Should().Be("A");
            response.OwnerId.Should().Be("A");
            response.RelatedDocumentId.Should().Be("A");
            response.TenantId.Should().Be("A");
            response.VariableTemplateId.Should().Be("A");
        }