public async Task Upload_Editor_ReturnsMappedConfig() { var json = "{}"; var testContext = TestHttpContextBuilder.CreateForPath($"/Editor/{clientId}/{nameof(SampleConfig)}") .WithClaims(configuratorClaim, clientConfiguratorClaim) .WithPost() .WithStringBody(json) .TestContext; var result = new Object(); uploadToEditorMapper.Setup(mapper => mapper.MapUploadToEditModel(json, It.Is <ConfigurationIdentity>(c => c.Client.Equals(expectedClient)), configCollection.GetConfigDefinition <SampleConfig>())) .Returns(result); await target.Handle(testContext, option); responseFactory.Verify(f => f.BuildJsonResponse(testContext, result)); }
public async Task Get_ReturnsConfigurationEditModelForClient() { var testContext = TestHttpContextBuilder.CreateForPath($"/{clientId}/{typeof(SampleConfig).Name}").WithClaims(readClaim).TestContext; var configInstance = new ConfigInstance <SampleConfig>(new SampleConfig(), new ConfigurationIdentity(expectedClient, new Version(1, 0))); configInstanceRouter.Setup(r => r.GetConfigInstanceOrDefault(expectedClient, typeof(SampleConfig).Name)) .ReturnsAsync(() => configInstance); var mappedModel = new object(); configurationEditModelMapper.Setup(m => m.MapToEditConfig(configInstance, (configCollection.GetConfigDefinition(typeof(SampleConfig))))) .Returns(() => mappedModel); await target.Handle(testContext, options); responseFactory.Verify(v => v.BuildJsonResponse(testContext, mappedModel)); }