public async Task Serialize_ConfigurationFileWithNoExpiry_SerializesCorrectly() { //Arrange var configurationFile = new ConfigurationFile(new List <string>()); //Act var json = JsonSerializer.Serialize(configurationFile, JsonFactory.GetOptions()); //Assert Assert.AreEqual(@"{""isLazy"":false,""dockerComposeYmlFilePaths"":[""docker-compose.yml""],""expiry"":""00:00:00"",""conversationMode"":""singleComment""}", json); }
protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder .Entity <Instance>() .HasIndex(instance => instance.Name) .IsUnique(); modelBuilder .Entity <Identity>() .HasIndex(identity => identity.Name) .IsUnique(); modelBuilder .Entity <AmazonUser>() .HasIndex(user => user.Name) .IsUnique(); modelBuilder .Entity <PullDogRepository>() .HasIndex(repository => new { repository.PullDogSettingsId, repository.Handle }) .IsUnique(); modelBuilder .Entity <PullDogPullRequest>() .Property(x => x.ConfigurationOverride) .HasConversion( x => JsonSerializer.Serialize(x, JsonFactory.GetOptions()), x => JsonSerializer.Deserialize <ConfigurationFileOverride>(x, JsonFactory.GetOptions())); modelBuilder .Entity <PullDogPullRequest>() .HasIndex(pullRequest => new { pullRequest.PullDogRepositoryId, pullRequest.Handle }) .IsUnique(); modelBuilder .Entity <Cluster>() .HasIndex(cluster => new { cluster.UserId, cluster.Name }) .IsUnique(); }
public async Task <ConfigurationFile?> GetConfigurationFileAsync() { var configurationFiles = await this.client.GetFilesForPathAsync("pull-dog.json"); var configurationFileEntry = configurationFiles.SingleOrDefault(); if (configurationFileEntry == null) { return(null); } var configurationFile = JsonSerializer.Deserialize <ConfigurationFile>( configurationFileEntry.Contents, JsonFactory.GetOptions()); return(configurationFile); }