public void CreateConfigurationMissingName() { var content = File.ReadAllText("../../../Fixtures/configuration_create.json"); var client = GetMockClient(content); var repo = new ConfigurationRepository(client.Object); var configuration = new Dictionary <string, object> { }; Assert.Throws <ValidationException>(() => repo.Create(configuration)); }
public void CreateConfigurationSuccessfully() { var content = File.ReadAllText("../../../Fixtures/configuration_create.json"); var client = GetMockClient(content); var repo = new ConfigurationRepository(client.Object); var configuration = new Dictionary <string, object> { { "name", "email_by_promisepay" } }; var resp = repo.Create(configuration); var created = JsonConvert.DeserializeObject <IDictionary <string, object> >(JsonConvert.SerializeObject(resp["feature_configurations"])); Assert.AreEqual("ca321b3f-db87-4d75-ba05-531c7f1bb515", created["id"]); Assert.AreEqual(configuration["name"], created["name"]); }
public void CreateWorkflowConfiguration(string name, string typeName) { var workflowConfiguration = WorkflowConfigurationFactory.Create(typeName, name); ConfigurationRepository.Create(workflowConfiguration); }
public void UpdateProfile(Guid UserId, UpdateProfileCommand command, string userName) { AssertConcern.AssertArgumentNotGuidEmpty(UserId, "Usuário inválido"); var profile = ProfileRepository.GetByUserId(UserId.ToString()); if (profile == null) { var genre = (TypePerson)command.Genre; var newProfile = new Profile(UserId.ToString(), genre); newProfile.GenerateNewId(); newProfile.Genre = genre; newProfile.MaritalStatus = (MaritalStatus)command.MaritalStatus; newProfile.ZipCode = command.ZipCode; newProfile.MaritalStatusInterest = (MaritalStatus)command.MaritalStatusInterest; newProfile.Summary = command.Summary; ProfileRepository.Save(newProfile, userName); } else { AssertConcern.AssertArgumentNotNull(profile, "Perfil não encontrado"); AssertConcern.AssertArgumentNotNull(profile.UserId, "Usuário não encontrado"); profile.Genre = (TypePerson)command.Genre; profile.MaritalStatus = (MaritalStatus)command.MaritalStatus; profile.ZipCode = profile.ZipCode; profile.MaritalStatusInterest = (MaritalStatus)command.MaritalStatusInterest; profile.Summary = command.Summary; ProfileRepository.Update(profile, userName); } if (command.Interests != null && command.Interests.Count > 0) { foreach (var item in command.Interests) { var configuration = ConfigurationRepository.Get(item.UserId, item.Key); if (configuration == null) { ConfigurationRepository.Create(item); } else { configuration.Value = item.Value; ConfigurationRepository.Update(configuration); } } } if (command.Relationships != null && command.Relationships.Count > 0) { foreach (var item in command.Relationships) { var configuration = ConfigurationRepository.Get(item.UserId, item.Key); if (configuration == null) { ConfigurationRepository.Create(item); } else { configuration.Value = item.Value; ConfigurationRepository.Update(configuration); } } } Uow.Commit(); }