diff --git a/Src/Dashboard/Mvc/HtmlExtensions.cs b/Src/Dashboard/Mvc/HtmlExtensions.cs
index c0a7f3f..18b2f41 100644
--- a/Src/Dashboard/Mvc/HtmlExtensions.cs
+++ b/Src/Dashboard/Mvc/HtmlExtensions.cs
@@ -21,8 +21,8 @@ public static string ActionFor(this IUrlHelper urlHelper, Expressio
public static HtmlString GetAppVersion()
{
- var version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
- return new HtmlString(version);
+ var version = typeof(HtmlExtensions).GetTypeInfo().Assembly.GetName().Version.ToString();
+ return new HtmlString(version);
}
[Pure]
diff --git a/Src/Dashboard/Mvc/PageElementsIds.cs b/Src/Dashboard/Mvc/PageElementsIds.cs
index 36ad6f4..1554973 100644
--- a/Src/Dashboard/Mvc/PageElementsIds.cs
+++ b/Src/Dashboard/Mvc/PageElementsIds.cs
@@ -1,6 +1,6 @@
namespace Tellurium.VisualAssertion.Dashboard.Mvc
{
- public class PageElementsIds
+ public static class PageElementsIds
{
public const string PageBody = "PageBody";
}
diff --git a/Src/Dashboard/Mvc/Utils/ServiceLocator.cs b/Src/Dashboard/Mvc/Utils/ServiceLocator.cs
index e034276..2dee1db 100644
--- a/Src/Dashboard/Mvc/Utils/ServiceLocator.cs
+++ b/Src/Dashboard/Mvc/Utils/ServiceLocator.cs
@@ -2,7 +2,7 @@
namespace Tellurium.VisualAssertion.Dashboard.Mvc.Utils
{
- public class ServiceLocator
+ public static class ServiceLocator
{
private static IWindsorContainer _container;
diff --git a/Src/Dashboard/Program.cs b/Src/Dashboard/Program.cs
index 3c11b4e..1e66a45 100644
--- a/Src/Dashboard/Program.cs
+++ b/Src/Dashboard/Program.cs
@@ -1,12 +1,11 @@
using System;
using System.Diagnostics;
using System.IO;
-using System.Threading;
using Topshelf;
namespace Tellurium.VisualAssertion.Dashboard
{
- public class Program
+ public static class Program
{
public static void Main(string[] args)
{
diff --git a/Src/MvcPages/BrowserCamera/Lens/BrowserCameraLensFactory.cs b/Src/MvcPages/BrowserCamera/Lens/BrowserCameraLensFactory.cs
index c3e1ee8..9162bbe 100644
--- a/Src/MvcPages/BrowserCamera/Lens/BrowserCameraLensFactory.cs
+++ b/Src/MvcPages/BrowserCamera/Lens/BrowserCameraLensFactory.cs
@@ -38,6 +38,7 @@ public static IBrowserCameraLens CreateLensForAutoMode(RemoteWebDriver webDriver
{
return new ResizeableLens(webDriver);
}
+
return new RegularLens(webDriver);
}
diff --git a/Src/MvcPages/BrowserCamera/Lens/ZoomableLens.cs b/Src/MvcPages/BrowserCamera/Lens/ZoomableLens.cs
index 1b6d542..bf79038 100644
--- a/Src/MvcPages/BrowserCamera/Lens/ZoomableLens.cs
+++ b/Src/MvcPages/BrowserCamera/Lens/ZoomableLens.cs
@@ -3,7 +3,7 @@
namespace Tellurium.MvcPages.BrowserCamera.Lens
{
- public class ZoomableLens:IBrowserCameraLens
+ public class ZoomableLens : IBrowserCameraLens
{
private readonly RemoteWebDriver driver;
diff --git a/Src/MvcPages/EndpointCoverage/EndpointCoverageReportBuilderFactory.cs b/Src/MvcPages/EndpointCoverage/EndpointCoverageReportBuilderFactory.cs
index b6c0640..8bbe826 100644
--- a/Src/MvcPages/EndpointCoverage/EndpointCoverageReportBuilderFactory.cs
+++ b/Src/MvcPages/EndpointCoverage/EndpointCoverageReportBuilderFactory.cs
@@ -3,7 +3,7 @@
namespace Tellurium.MvcPages.EndpointCoverage
{
- public class EndpointCoverageReportBuilderFactory
+ public static class EndpointCoverageReportBuilderFactory
{
public static EndpointCoverageReportBuilder Create(BrowserAdapterConfig config, IEndpointCollector endpointCollector)
{
diff --git a/Src/MvcPages/EndpointCoverage/EndpointExplorers/AspMvcEndpointExplorer.cs b/Src/MvcPages/EndpointCoverage/EndpointExplorers/AspMvcEndpointExplorer.cs
index 607d489..b53f7c4 100644
--- a/Src/MvcPages/EndpointCoverage/EndpointExplorers/AspMvcEndpointExplorer.cs
+++ b/Src/MvcPages/EndpointCoverage/EndpointExplorers/AspMvcEndpointExplorer.cs
@@ -6,10 +6,10 @@
namespace Tellurium.MvcPages.EndpointCoverage.EndpointExplorers
{
- public class AspMvcEndpointExplorer:IEndpointExplorer
+ public class AspMvcEndpointExplorer : IEndpointExplorer
{
private readonly IReadOnlyList availableEndpointsAssemblies;
-
+
public AspMvcEndpointExplorer(IReadOnlyList availableEndpointsAssemblies)
{
@@ -44,25 +44,32 @@ private static string GetActionUrl(Type controller, MethodInfo action)
static IReadOnlyList GetAllControllers(Assembly assembly)
{
-
+
return assembly.GetTypes().Where(InheritFromController).ToList();
}
- const string AspControllerNamespace = "System.Web.Mvc.Controller";
+ private const string AspControllerNamespace = "System.Web.Mvc.Controller";
private const string AspCoreControllerNamespace = "Microsoft.AspNetCore.Mvc";
private static bool InheritFromController(Type t)
{
- if (t == typeof(object) || t.BaseType == null)
+ if (t == typeof(object))
+ {
+ return false;
+ }
+
+ var baseType = t.GetTypeInfo().BaseType;
+
+ if (baseType == null)
{
return false;
}
- if (t.BaseType.Namespace == AspControllerNamespace || t.BaseType.Namespace == AspCoreControllerNamespace)
+ if (baseType.Namespace == AspControllerNamespace || baseType.Namespace == AspCoreControllerNamespace)
{
return true;
}
- return InheritFromController(t.BaseType);
+ return InheritFromController(baseType);
}
private static IReadOnlyList GetAllActionsUrlForController(Type controller)
diff --git a/Src/MvcPages/EndpointCoverage/EndpointExplorers/CompositeEndpointExplorer.cs b/Src/MvcPages/EndpointCoverage/EndpointExplorers/CompositeEndpointExplorer.cs
index da7b859..bfb505e 100644
--- a/Src/MvcPages/EndpointCoverage/EndpointExplorers/CompositeEndpointExplorer.cs
+++ b/Src/MvcPages/EndpointCoverage/EndpointExplorers/CompositeEndpointExplorer.cs
@@ -2,7 +2,7 @@
namespace Tellurium.MvcPages.EndpointCoverage.EndpointExplorers
{
- public class CompositeEndpointExplorer:IEndpointExplorer
+ public class CompositeEndpointExplorer : IEndpointExplorer
{
private readonly IEndpointExplorer[] endpointsExplorers;
diff --git a/Src/MvcPages/EndpointCoverage/EndpointExplorers/ExplicitEndpointExplorer.cs b/Src/MvcPages/EndpointCoverage/EndpointExplorers/ExplicitEndpointExplorer.cs
index 4bcff3d..c9c3742 100644
--- a/Src/MvcPages/EndpointCoverage/EndpointExplorers/ExplicitEndpointExplorer.cs
+++ b/Src/MvcPages/EndpointCoverage/EndpointExplorers/ExplicitEndpointExplorer.cs
@@ -2,7 +2,7 @@
namespace Tellurium.MvcPages.EndpointCoverage.EndpointExplorers
{
- public class ExplicitEndpointExplorer:IEndpointExplorer
+ public class ExplicitEndpointExplorer : IEndpointExplorer
{
private readonly IReadOnlyList knownEndpoints;
diff --git a/Src/MvcPages/Reports/ErrorReport/TelluriumErrorReportBuilderFactory.cs b/Src/MvcPages/Reports/ErrorReport/TelluriumErrorReportBuilderFactory.cs
index c654265..43e26d9 100644
--- a/Src/MvcPages/Reports/ErrorReport/TelluriumErrorReportBuilderFactory.cs
+++ b/Src/MvcPages/Reports/ErrorReport/TelluriumErrorReportBuilderFactory.cs
@@ -1,4 +1,5 @@
using System;
+using System.IO;
using Tellurium.MvcPages.Configuration;
namespace Tellurium.MvcPages.Reports.ErrorReport
@@ -9,7 +10,7 @@ public static TelluriumErrorReportBuilder Create(BrowserAdapterConfig config)
{
var writeOutput = config.WriteOutput ?? Console.WriteLine;
var outputDir = string.IsNullOrWhiteSpace(config.ErrorReportOutputDir)
- ? Environment.CurrentDirectory
+ ? Directory.GetCurrentDirectory()
: config.ErrorReportOutputDir;
var ciAdapter = new TeamCityAdapter(writeOutput);
return new TelluriumErrorReportBuilder(outputDir, writeOutput, ciAdapter);
diff --git a/Src/MvcPages/SeleniumUtils/FileUploading/FileUploadingExtensions.cs b/Src/MvcPages/SeleniumUtils/FileUploading/FileUploadingExtensions.cs
index 85763fd..d4fc856 100644
--- a/Src/MvcPages/SeleniumUtils/FileUploading/FileUploadingExtensions.cs
+++ b/Src/MvcPages/SeleniumUtils/FileUploading/FileUploadingExtensions.cs
@@ -62,23 +62,25 @@ private static string MapToAbsoluteFilePath(string filePath)
private static string ToAbsolutePath(string filePath)
{
- if (AppDomain.CurrentDomain.SetupInformation.PrivateBinPath != null)
+ // TODO: This needs to be reworked if we want to target .NET Core (however it will work on .NET 5.0)
+ string privateBinPath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;
+ if (privateBinPath != null)
{
- foreach (var rootPath in AppDomain.CurrentDomain.SetupInformation.PrivateBinPath.Split(';'))
+ foreach (var rootPath in privateBinPath.Split(';'))
{
- var absolutePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, rootPath, filePath);
+ var absolutePath = Path.Combine(System.AppContext.BaseDirectory, rootPath, filePath);
if (File.Exists(absolutePath))
{
return absolutePath;
}
}
}
- return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, filePath);
+ return Path.Combine(System.AppContext.BaseDirectory, filePath);
}
- private static string ReadFileContentFromEmbededResource(string fileName)
+ private static string ReadFileContentFromEmbeddedResource(string fileName)
{
- var assembly = Assembly.GetExecutingAssembly();
+ var assembly = typeof(FileUploadingExtensions).GetTypeInfo().Assembly;
var currentNamespace = typeof(FileUploadingExtensions).Namespace;
using (Stream stream = assembly.GetManifestResourceStream($"{currentNamespace}.{fileName}"))
{
diff --git a/Src/MvcPages/Utils/Timeouts.cs b/Src/MvcPages/Utils/Timeouts.cs
index 620f326..c2827e3 100644
--- a/Src/MvcPages/Utils/Timeouts.cs
+++ b/Src/MvcPages/Utils/Timeouts.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tellurium.MvcPages.Utils
+namespace Tellurium.MvcPages.Utils
{
public static class Timeouts
{
diff --git a/Src/MvcPages/WebPages/WebForms/DefaultInputAdapters/SelectFormInputAdapter.cs b/Src/MvcPages/WebPages/WebForms/DefaultInputAdapters/SelectFormInputAdapter.cs
index ccdc976..0cbe2f4 100644
--- a/Src/MvcPages/WebPages/WebForms/DefaultInputAdapters/SelectFormInputAdapter.cs
+++ b/Src/MvcPages/WebPages/WebForms/DefaultInputAdapters/SelectFormInputAdapter.cs
@@ -10,7 +10,7 @@ public class SelectFormInputAdapter : IFormInputAdapter
public bool CanHandle(IWebElement webElement)
{
- return webElement.TagName.ToLower() == "select";
+ return string.Equals(webElement.TagName, "select", System.StringComparison.OrdinalIgnoreCase);
}
public void SetValue(IWebElement webElement, string value)
diff --git a/Src/MvcPages/WebPages/WebForms/DefaultInputAdapters/TextFormInputAdapter.cs b/Src/MvcPages/WebPages/WebForms/DefaultInputAdapters/TextFormInputAdapter.cs
index 57721e6..3b15b7f 100644
--- a/Src/MvcPages/WebPages/WebForms/DefaultInputAdapters/TextFormInputAdapter.cs
+++ b/Src/MvcPages/WebPages/WebForms/DefaultInputAdapters/TextFormInputAdapter.cs
@@ -7,7 +7,7 @@ public class TextFormInputAdapter : IFormInputAdapter
{
public bool CanHandle(IWebElement webElement)
{
- if (webElement.TagName.ToLower() == "textarea")
+ if (string.Equals(webElement.TagName, "textarea", System.StringComparison.OrdinalIgnoreCase))
{
return true;
}
diff --git a/Src/Sample.Website/App_Start/FilterConfig.cs b/Src/Sample.Website/App_Start/FilterConfig.cs
index 4cbc04f..c2c0105 100644
--- a/Src/Sample.Website/App_Start/FilterConfig.cs
+++ b/Src/Sample.Website/App_Start/FilterConfig.cs
@@ -2,7 +2,7 @@
namespace Tellurium.Sample.Website
{
- public class FilterConfig
+ public static class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
diff --git a/Src/Sample.Website/App_Start/RouteConfig.cs b/Src/Sample.Website/App_Start/RouteConfig.cs
index 8f82466..33d5708 100644
--- a/Src/Sample.Website/App_Start/RouteConfig.cs
+++ b/Src/Sample.Website/App_Start/RouteConfig.cs
@@ -3,7 +3,7 @@
namespace Tellurium.Sample.Website
{
- public class RouteConfig
+ public static class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
diff --git a/Src/Sample.Website/Sample.Website.csproj b/Src/Sample.Website/Sample.Website.csproj
index 9af95c0..e9b8bff 100644
--- a/Src/Sample.Website/Sample.Website.csproj
+++ b/Src/Sample.Website/Sample.Website.csproj
@@ -274,7 +274,6 @@
MinimumRecommendedRules.ruleset
-
diff --git a/Src/VisualAssertions/Infrastructure/IQueryAll.cs b/Src/VisualAssertions/Infrastructure/IQueryAll.cs
index 86066fe..c2b0dcf 100644
--- a/Src/VisualAssertions/Infrastructure/IQueryAll.cs
+++ b/Src/VisualAssertions/Infrastructure/IQueryAll.cs
@@ -3,7 +3,7 @@
namespace Tellurium.VisualAssertions.Infrastructure
{
- public interface IQueryAll where TEntity:Entity
+ public interface IQueryAll where TEntity : Entity
{
List GetQuery(IQueryable query);
}
diff --git a/Src/VisualAssertions/Screenshots/Domain/BlindRegion.cs b/Src/VisualAssertions/Screenshots/Domain/BlindRegion.cs
index cad2def..c8d5161 100644
--- a/Src/VisualAssertions/Screenshots/Domain/BlindRegion.cs
+++ b/Src/VisualAssertions/Screenshots/Domain/BlindRegion.cs
@@ -1,4 +1,3 @@
-using Tellurium.MvcPages.BrowserCamera;
using Tellurium.VisualAssertions.Infrastructure;
namespace Tellurium.VisualAssertions.Screenshots.Domain
diff --git a/Src/VisualAssertions/Screenshots/Service/ComparisonStrategies/PixelByPixelComparisonStrategy.cs b/Src/VisualAssertions/Screenshots/Service/ComparisonStrategies/PixelByPixelComparisonStrategy.cs
index 5a642ce..2f72d64 100644
--- a/Src/VisualAssertions/Screenshots/Service/ComparisonStrategies/PixelByPixelComparisonStrategy.cs
+++ b/Src/VisualAssertions/Screenshots/Service/ComparisonStrategies/PixelByPixelComparisonStrategy.cs
@@ -133,7 +133,6 @@ private byte GetBitsPerPixel(PixelFormat pixelFormat)
break;
default:
throw new ArgumentException("Only 24 and 32 bit images are supported");
-
}
}
}
diff --git a/Src/VisualAssertions/Screenshots/Service/VisualAssertionsService.cs b/Src/VisualAssertions/Screenshots/Service/VisualAssertionsService.cs
index 5c7687b..dcddc5a 100644
--- a/Src/VisualAssertions/Screenshots/Service/VisualAssertionsService.cs
+++ b/Src/VisualAssertions/Screenshots/Service/VisualAssertionsService.cs
@@ -42,10 +42,12 @@ public VisualAssertionsService(
public void CheckViewWithPattern(IBrowserCamera browserCamera, string viewName)
{
var screenshotIdentity = new ScreenshotIdentity(ProjectName, BrowserName, ScreenshotCategory, viewName);
+
if (takenScreenshots.Contains(screenshotIdentity))
{
throw new DuplicatedScreenshotInSession(screenshotIdentity);
}
+
var screenshot = browserCamera.TakeScreenshot();
takenScreenshots.Add(screenshotIdentity);
ScreenshotProcessor.Post(new Screenshot
diff --git a/Src/VisualAssertions/Screenshots/Utils/TaskProcessing/ITaskProcessor.cs b/Src/VisualAssertions/Screenshots/Utils/TaskProcessing/ITaskProcessor.cs
index 6bd9b21..193f573 100644
--- a/Src/VisualAssertions/Screenshots/Utils/TaskProcessing/ITaskProcessor.cs
+++ b/Src/VisualAssertions/Screenshots/Utils/TaskProcessing/ITaskProcessor.cs
@@ -2,7 +2,7 @@
namespace Tellurium.VisualAssertions.Screenshots.Utils.TaskProcessing
{
- public interface ITaskProcessor: IDisposable
+ public interface ITaskProcessor : IDisposable
{
void Post(T data);
}
diff --git a/Src/VisualAssertions/Screenshots/Utils/TaskProcessing/TaskProcessorFactory.cs b/Src/VisualAssertions/Screenshots/Utils/TaskProcessing/TaskProcessorFactory.cs
index 308157a..f1e1d3c 100644
--- a/Src/VisualAssertions/Screenshots/Utils/TaskProcessing/TaskProcessorFactory.cs
+++ b/Src/VisualAssertions/Screenshots/Utils/TaskProcessing/TaskProcessorFactory.cs
@@ -20,7 +20,7 @@ public static ITaskProcessor Create(TaskProcessorType processorType, Actio
enum TaskProcessorType
{
- Sync=1,
+ Sync = 1,
Async
}
}
\ No newline at end of file
diff --git a/Src/VisualAssertions/TestRunnersAdapters/Providers/TeamCityRunnerAdapter.cs b/Src/VisualAssertions/TestRunnersAdapters/Providers/TeamCityRunnerAdapter.cs
index 1ace065..4ac0bf0 100644
--- a/Src/VisualAssertions/TestRunnersAdapters/Providers/TeamCityRunnerAdapter.cs
+++ b/Src/VisualAssertions/TestRunnersAdapters/Providers/TeamCityRunnerAdapter.cs
@@ -91,7 +91,7 @@ private void UploadReportTabToCI(TestSession session, string browserName)