Skip to content

Commit

Permalink
Consolidating ruleset files. Cleaning up warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocav committed Aug 13, 2018
1 parent 913eca7 commit 8ed6fb6
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 103 deletions.
2 changes: 1 addition & 1 deletion build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<PackageLicenseUrl>http://www.microsoft.com/web/webpi/eula/aspnetcomponent_rtw_enu.htm</PackageLicenseUrl>
<PackageIconUrl>https://raw.githubusercontent.com/Azure/azure-webjobs-sdk/dev/webjobs.png</PackageIconUrl>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)..\src\src.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)..\src.ruleset</CodeAnalysisRuleSet>
<NoWarn>$(NoWarn);NU1701</NoWarn>
<DebugType>embedded</DebugType>
<UseSourceLink Condition="$(UseSourceLink) == '' And $(CI) != ''">true</UseSourceLink>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<IsPackable>false</IsPackable>
<AssemblyName>Microsoft.Azure.WebJobs.Script.Scaling.Tests</AssemblyName>
<RootNamespace>Microsoft.Azure.WebJobs.Script.Scaling.Tests</RootNamespace>
<CodeAnalysisRuleSet>$(SolutionDir)\src\src.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\WebJobs.Script.Tests.Shared\TestScopedEnvironmentVariable.cs" Link="TestScopedEnvironmentVariable.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class StandbyManagerTests : IDisposable
private TestLoggerProvider _loggerProvider;
private HttpClient _httpClient;
private TestServer _httpServer;
private string _expectedHostId;
private string _expectedHostId = "update when tests fixed";
private ScriptApplicationHostOptions _webHostOptions;
private string _testRootPath;

Expand Down
10 changes: 5 additions & 5 deletions test/WebJobs.Script.Tests.Shared/TestLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public TestLogger(string category, Func<string, LogLevel, bool> filter = null)

public string Category { get; private set; }

private string DebuggerDisplay
{
get { return $"Category: {Category}, Count: {_logMessages.Count}"; }
}

public IDisposable BeginScope<TState>(TState state) => DictionaryLoggerScope.Push(state);

public bool IsEnabled(LogLevel logLevel)
Expand Down Expand Up @@ -74,11 +79,6 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
_logMessages.Add(logMessage);
}
}

private string DebuggerDisplay
{
get { return $"Category: {Category}, Count: {_logMessages.Count}"; }
}
}

public class LogMessage
Expand Down
36 changes: 0 additions & 36 deletions test/WebJobs.Script.Tests.Shared/TestScriptJobHostEnvironment.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<Compile Include="$(MSBuildThisFileDirectory)TestHostBuilderExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)TestHostExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)TestNameResolver.cs" />
<Compile Include="$(MSBuildThisFileDirectory)TestScriptJobHostEnvironment.cs" />
<Compile Include="$(MSBuildThisFileDirectory)TestTraits.cs" />
<Compile Include="$(MSBuildThisFileDirectory)TestHandler.cs" />
<Compile Include="$(MSBuildThisFileDirectory)TestHelpers.cs" />
Expand Down
23 changes: 23 additions & 0 deletions test/WebJobs.Script.Tests/FileMonitoringServiceTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Azure.WebJobs.Script.WebHost;
using Xunit;

namespace Microsoft.Azure.WebJobs.Script.Tests
{
public class FileMonitoringServiceTests
{
[Theory]
[InlineData(@"C:\Functions\Scripts\Shared\Test.csx", "Shared")]
[InlineData(@"C:\Functions\Scripts\Shared\Sub1\Sub2\Test.csx", "Shared")]
[InlineData(@"C:\Functions\Scripts\Shared", "Shared")]
public static void GetRelativeDirectory_ReturnsExpectedDirectoryName(string path, string expected)
{
Assert.Equal(expected, FileMonitoringService.GetRelativeDirectory(path, @"C:\Functions\Scripts"));
}
}
}
17 changes: 5 additions & 12 deletions test/WebJobs.Script.Tests/ScriptHostTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Microsoft.Azure.WebJobs.Script.Config;
using Microsoft.Azure.WebJobs.Script.Description;
using Microsoft.Azure.WebJobs.Script.Eventing;
using Microsoft.Azure.WebJobs.Script.WebHost;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -71,7 +72,7 @@ public void LoadHostConfig_ParseError_Throws()
{
var path = Path.Combine(TestHelpers.FunctionsTestDirectory, "host.json");
File.WriteAllText(path, "{ blah");
JObject config = null;
//JObject config = null;
var logger = _loggerFactory.CreateLogger(LogCategories.Startup);
var ex = Assert.Throws<FormatException>(() =>
{
Expand All @@ -80,16 +81,6 @@ public void LoadHostConfig_ParseError_Throws()
Assert.Equal($"Unable to parse host configuration file '{path}'.", ex.Message);
}

[Theory]
[InlineData(@"C:\Functions\Scripts\Shared\Test.csx", "Shared")]
[InlineData(@"C:\Functions\Scripts\Shared\Sub1\Sub2\Test.csx", "Shared")]
[InlineData(@"C:\Functions\Scripts\Shared", "Shared")]
public static void GetRelativeDirectory_ReturnsExpectedDirectoryName(string path, string expected)
{
// TODO: DI (FACAVAL) This logic moved to the FileMonitoringService
//Assert.Equal(expected, ScriptHost.GetRelativeDirectory(path, @"C:\Functions\Scripts"));
}

[Fact]
public static async Task OnDebugModeFileChanged_TriggeredWhenDebugFileUpdated()
{
Expand Down Expand Up @@ -1040,13 +1031,15 @@ public void ConfigureLoggerFactory_Default()
//Assert.Equal(MetricEventNames.ApplicationInsightsDisabled, metricsLogger.LoggedEvents[0]);
}

[Theory]
[Theory(Skip = "brettsam working on this functionality")]
[InlineData("always")]
[InlineData("never")]
[InlineData("")]
[InlineData(null)]
public void ConfigureLoggerFactory_ApplicationInsights(string consoleLoggingEnabled)
{
// TODO: Brettsam ?
System.Diagnostics.Trace.Write(consoleLoggingEnabled);
//var config = new ScriptHostConfiguration();
//var loggerFactoryMock = new Mock<ILoggerFactory>(MockBehavior.Loose);
//loggerFactoryMock.Setup(x => x.AddProvider(It.IsAny<ILoggerProvider>()));
Expand Down
1 change: 0 additions & 1 deletion test/WebJobs.Script.Tests/WebJobs.Script.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<AssemblyName>Microsoft.Azure.WebJobs.Script.Tests</AssemblyName>

<RootNamespace>Microsoft.Azure.WebJobs.Script.Tests</RootNamespace>
<CodeAnalysisRuleSet>$(SolutionDir)\src\src.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;DEBUG;NETCOREAPP2_0;SCRIPT_TEST</DefineConstants>
Expand Down
45 changes: 0 additions & 45 deletions test/test.ruleset

This file was deleted.

0 comments on commit 8ed6fb6

Please sign in to comment.