Deleted ValueProvidersWebSite and tests

This commit is contained in:
Kiran Challa 2015-12-01 07:30:17 -08:00
parent 9539c373ba
commit 6712f9d9ff
11 changed files with 0 additions and 240 deletions

15
Mvc.sln
View File

@ -86,8 +86,6 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "RazorEmbeddedViewsWebSite",
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "CompositeViewEngineWebSite", "test\WebSites\CompositeViewEngineWebSite\CompositeViewEngineWebSite.xproj", "{A853B2BA-4449-4908-A416-5A3C027FC22B}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ValueProvidersWebSite", "test\WebSites\ValueProvidersWebSite\ValueProvidersWebSite.xproj", "{14F79E79-AE79-48FA-95DE-D794EF4EABB3}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "HtmlGenerationWebSite", "test\WebSites\HtmlGenerationWebSite\HtmlGenerationWebSite.xproj", "{920F8A0E-6F7D-4BBE-84FF-840B89099BE6}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ActionResultsWebSite", "test\WebSites\ActionResultsWebSite\ActionResultsWebSite.xproj", "{0A6BB4C0-48D3-4E7F-952B-B8917345E075}"
@ -536,18 +534,6 @@ Global
{A853B2BA-4449-4908-A416-5A3C027FC22B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{A853B2BA-4449-4908-A416-5A3C027FC22B}.Release|x86.ActiveCfg = Release|Any CPU
{A853B2BA-4449-4908-A416-5A3C027FC22B}.Release|x86.Build.0 = Release|Any CPU
{14F79E79-AE79-48FA-95DE-D794EF4EABB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{14F79E79-AE79-48FA-95DE-D794EF4EABB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{14F79E79-AE79-48FA-95DE-D794EF4EABB3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{14F79E79-AE79-48FA-95DE-D794EF4EABB3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{14F79E79-AE79-48FA-95DE-D794EF4EABB3}.Debug|x86.ActiveCfg = Debug|Any CPU
{14F79E79-AE79-48FA-95DE-D794EF4EABB3}.Debug|x86.Build.0 = Debug|Any CPU
{14F79E79-AE79-48FA-95DE-D794EF4EABB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{14F79E79-AE79-48FA-95DE-D794EF4EABB3}.Release|Any CPU.Build.0 = Release|Any CPU
{14F79E79-AE79-48FA-95DE-D794EF4EABB3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{14F79E79-AE79-48FA-95DE-D794EF4EABB3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{14F79E79-AE79-48FA-95DE-D794EF4EABB3}.Release|x86.ActiveCfg = Release|Any CPU
{14F79E79-AE79-48FA-95DE-D794EF4EABB3}.Release|x86.Build.0 = Release|Any CPU
{920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{920F8A0E-6F7D-4BBE-84FF-840B89099BE6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
@ -1092,7 +1078,6 @@ Global
{59E1BE90-92C1-4D35-ADCC-B69F49077C81} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
{B18ADE62-35DE-4A06-8E1D-EDD6245F7F4D} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
{A853B2BA-4449-4908-A416-5A3C027FC22B} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
{14F79E79-AE79-48FA-95DE-D794EF4EABB3} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
{920F8A0E-6F7D-4BBE-84FF-840B89099BE6} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
{0A6BB4C0-48D3-4E7F-952B-B8917345E075} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}
{0AD78AB5-D67C-49BC-81B1-0C51BFA82B5E} = {16703B76-C9F7-4C75-AE6C-53D92E308E3C}

View File

@ -1,65 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Net.Http;
using System.Threading.Tasks;
using Xunit;
namespace Microsoft.AspNet.Mvc.FunctionalTests
{
public class ValueProviderTest : IClassFixture<MvcTestFixture<ValueProvidersWebSite.Startup>>
{
public ValueProviderTest(MvcTestFixture<ValueProvidersWebSite.Startup> fixture)
{
Client = fixture.Client;
}
public HttpClient Client { get; }
[Fact]
public async Task ValueProviderFactories_AreVisitedInSequentialOrder_ForValueProviders()
{
// Arrange & Act
var body = await Client.GetStringAsync("http://localhost/Home/TestValueProvider?test=not-test-value");
// Assert
Assert.Equal("custom-value-provider-value", body.Trim());
}
[Fact]
public async Task ValueProviderFactories_ReturnsValuesFromQueryValueProvider()
{
// Arrange & Act
var body = await Client.GetStringAsync("http://localhost/Home/DefaultValueProviders?test=query-value");
// Assert
Assert.Equal("query-value", body.Trim());
}
[Fact]
public async Task ValueProviderFactories_ReturnsValuesFromRouteValueProvider()
{
// Arrange & Act
var body = await Client.GetStringAsync("http://localhost/RouteTest/route-value");
// Assert
Assert.Equal("route-value", body.Trim());
}
[Theory]
[InlineData("http://localhost/Home/GetFlagValuesAsString?flags=1", "Value1")]
[InlineData("http://localhost/Home/GetFlagValuesAsString?flags=5", "Value1, Value4")]
[InlineData("http://localhost/Home/GetFlagValuesAsString?flags=7", "Value1, Value2, Value4")]
[InlineData("http://localhost/Home/GetFlagValuesAsString?flags=0", "0")]
[InlineData("http://localhost/Home/GetFlagValuesAsInt?flags=Value1", "1")]
[InlineData("http://localhost/Home/GetFlagValuesAsInt?flags=Value1,Value2", "3")]
public async Task ValueProvider_DeserializesEnumsWithFlags(string url, string expected)
{
// Arrange & Act
var body = await Client.GetStringAsync(url);
// Assert
Assert.Equal(expected, body.Trim());
}
}
}

View File

@ -56,7 +56,6 @@
"TagHelpersWebSite": "1.0.0",
"UrlHelperWebSite": "1.0.0",
"ValidationWebSite": "1.0.0",
"ValueProvidersWebSite": "1.0.0",
"VersioningWebSite": "1.0.0",
"WebApiCompatShimWebSite": "1.0.0",
"XmlFormattersWebSite": "1.0.0",

View File

@ -1,38 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Globalization;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Mvc.ModelBinding;
namespace ValueProvidersWebSite
{
public class CustomValueProviderFactory : IValueProviderFactory
{
public Task<IValueProvider> GetValueProviderAsync(ActionContext context)
{
if (context.HttpContext.Request.Path.Value.Contains("TestValueProvider"))
{
return Task.FromResult<IValueProvider>(new CustomValueProvider());
}
return Task.FromResult<IValueProvider>(null);
}
private class CustomValueProvider : IValueProvider
{
public bool ContainsPrefix(string prefix)
{
return string.Equals(prefix, "test", StringComparison.OrdinalIgnoreCase);
}
public ValueProviderResult GetValue(string key)
{
var value = "custom-value-provider-value";
return new ValueProviderResult(value, CultureInfo.CurrentCulture);
}
}
}
}

View File

@ -1,16 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace ValueProvidersWebSite
{
[Flags]
public enum FlagsEnum
{
Value1 = 1,
Value2 = 2,
Value4 = 4,
Value8 = 8
}
}

View File

@ -1,36 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Mvc;
namespace ValueProvidersWebSite
{
public class HomeController
{
public string TestValueProvider(string test)
{
return test;
}
public string DefaultValueProviders(string test)
{
return test;
}
[HttpGet("/RouteTest/{test}")]
public string RouteValueProviders(string test)
{
return test;
}
public string GetFlagValuesAsString(FlagsEnum flags)
{
return flags.ToString();
}
public int GetFlagValuesAsInt(FlagsEnum flags)
{
return (int)flags;
}
}
}

View File

@ -1,28 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Mvc;
using Microsoft.Extensions.DependencyInjection;
namespace ValueProvidersWebSite
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services
.AddMvc(options =>
{
options.ValueProviderFactories.Insert(1, new CustomValueProviderFactory());
});
}
public void Configure(IApplicationBuilder app)
{
app.UseCultureReplacer();
app.UseMvcWithDefaultRoute();
}
}
}

View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>14f79e79-ae79-48fa-95de-d794ef4eabb3</ProjectGuid>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<DevelopmentServerPort>1100</DevelopmentServerPort>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -1,18 +0,0 @@
{
"commands": {
"web": "Microsoft.AspNet.Hosting server=Microsoft.AspNet.Server.WebListener server.urls=http://localhost:5001",
"kestrel": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://localhost:5000"
},
"dependencies": {
"Microsoft.AspNet.Server.Kestrel": "1.0.0-*",
"Microsoft.AspNet.Mvc": "6.0.0-*",
"Microsoft.AspNet.Mvc.TestConfiguration": "1.0.0",
"Microsoft.AspNet.Server.WebListener": "1.0.0-*",
"Microsoft.AspNet.StaticFiles": "1.0.0-*"
},
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
"webroot": "wwwroot"
}

View File

@ -1,4 +0,0 @@
ValueProvidersWebSite
===
This web site illustrates how to register and use custom value providers.

View File

@ -1 +0,0 @@
HelloWorld