private void ApplyChangedApplicationToggleValues(IList <ClientApplicationToggleValue> changedAppToggleValues,
                                                  Action <ToggleValueDbEntity> applyAction)
 {
     foreach (ClientApplicationToggleValue businessEntity in changedAppToggleValues)
     {
         ToggleValueDbEntity dbEntity = this.ConvertToDbEntity(businessEntity);
         applyAction(dbEntity);
     }
 }
Beispiel #2
0
        private ToggleValueDbEntity CreateToggleValueDbEntity()
        {
            var toggleValue = new ToggleValueDbEntity()
            {
                ApplicationCodeName = "TestApp",
                ApplicationVersion  = "1.0",
                Value = true
            };

            return(toggleValue);
        }
        private ClientApplication CreateClientApplicationThatHasValues()
        {
            ToggleValueDbEntity toggleValueDbEntity =
                this.mockedToggleValueDbEntitiesCreator.CreateToggleValueDbEntity();
            var clientApplication = new ClientApplication()
            {
                CodeName = toggleValueDbEntity.ApplicationCodeName,
                Version  = toggleValueDbEntity.ApplicationVersion
            };

            return(clientApplication);
        }
        private ToggleValueDbEntity ConvertToDbEntity(ClientApplicationToggleValue businessEntity)
        {
            ToggleValueDbEntity dbEntity = new ToggleValueDbEntity()
            {
                Id = businessEntity.Id,
                ApplicationCodeName = businessEntity.Application.CodeName,
                ApplicationVersion  = businessEntity.Application.Version,
                ToggleId            = businessEntity.ToggleId,
                Value = businessEntity.Value
            };

            return(dbEntity);
        }
        public IList <ToggleValueDbEntity> CreateList(int nrOfItems = 3)
        {
            IList <ToggleValueDbEntity> toggleValues = new List <ToggleValueDbEntity>();

            for (int i = 0; i < nrOfItems; i++)
            {
                ToggleValueDbEntity toggleValue = i == 0
                    ? this.CreateGlobalToggleValueDbEntity()
                    : this.CreateToggleValueDbEntity();
                toggleValues.Add(toggleValue);
            }
            return(toggleValues);
        }
Beispiel #6
0
        private ClientApplicationToggleValue ConvertToBusinessEntity(ToggleValueDbEntity toggleValueDbEntity)
        {
            var toggleValue = new ClientApplicationToggleValue()
            {
                Id          = toggleValueDbEntity.Id,
                ToggleId    = toggleValueDbEntity.ToggleId,
                Value       = toggleValueDbEntity.Value,
                Application = new ClientApplication()
                {
                    CodeName = toggleValueDbEntity.ApplicationCodeName,
                    Version  = toggleValueDbEntity.ApplicationVersion
                }
            };

            return(toggleValue);
        }
        private ToggleValueDbEntity CreateToggleValueDbEntity(string appCodeName, string appVersion = null)
        {
            var toggle = new ToggleDbEntity()
            {
                CodeName = Guid.NewGuid().ToString()
            };
            var toggleValue = new ToggleValueDbEntity()
            {
                ApplicationCodeName = appCodeName,
                ApplicationVersion  = appVersion,
                Value    = true,
                Toggle   = toggle,
                ToggleId = toggle.Id
            };

            return(toggleValue);
        }