Skip to content

Commit

Permalink
Update tests for IImportScopeWrapper to run in all test projects
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornhellander committed Jan 3, 2024
1 parent a7f11d5 commit 972a866
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

namespace StyleCop.Analyzers.Test.CSharp10.Lightup
{
using StyleCop.Analyzers.Test.CSharp9.Lightup;

public partial class IImportScopeWrapperCSharp10UnitTests : IImportScopeWrapperCSharp9UnitTests
{
}
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,17 @@
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

namespace StyleCop.Analyzers.Test.Lightup
namespace StyleCop.Analyzers.Test.CSharp11.Lightup
{
using System;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
using StyleCop.Analyzers.Lightup;
using StyleCop.Analyzers.Test.CSharp10.Lightup;
using Xunit;

public class IImportScopeWrapperCSharp11UnitTests
public partial class IImportScopeWrapperCSharp11UnitTests : IImportScopeWrapperCSharp10UnitTests
{
[Fact]
public void TestNull()
{
object? obj = null;
Assert.False(IImportScopeWrapper.IsInstance(obj!));
var wrapper = IImportScopeWrapper.FromObject(obj!);
Assert.Throws<NullReferenceException>(() => wrapper.Aliases);
}

[Fact]
public void TestIncompatibleInstance()
{
var obj = new object();
Assert.False(IImportScopeWrapper.IsInstance(obj));
Assert.Throws<InvalidCastException>(() => IImportScopeWrapper.FromObject(obj));
}

[Fact]
public void TestCompatibleInstance()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

namespace StyleCop.Analyzers.Test.Lightup
namespace StyleCop.Analyzers.Test.CSharp12.Lightup
{
using StyleCop.Analyzers.Test.CSharp11.Lightup;

public partial class IImportScopeWrapperCSharp12UnitTests : IImportScopeWrapperCSharp11UnitTests
{
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

namespace StyleCop.Analyzers.Test.CSharp7.Lightup
{
using StyleCop.Analyzers.Test.Lightup;

public partial class IImportScopeWrapperCSharp7UnitTests : IImportScopeWrapperUnitTests
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

namespace StyleCop.Analyzers.Test.CSharp8.Lightup
{
using StyleCop.Analyzers.Test.CSharp7.Lightup;

public partial class IImportScopeWrapperCSharp8UnitTests : IImportScopeWrapperCSharp7UnitTests
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

namespace StyleCop.Analyzers.Test.CSharp9.Lightup
{
using StyleCop.Analyzers.Test.CSharp8.Lightup;

public partial class IImportScopeWrapperCSharp9UnitTests : IImportScopeWrapperCSharp8UnitTests
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

namespace StyleCop.Analyzers.Test.Lightup
{
using System;
using StyleCop.Analyzers.Lightup;
using Xunit;

public class IImportScopeWrapperUnitTests
{
[Fact]
public void TestNull()
{
object? obj = null;
Assert.False(IImportScopeWrapper.IsInstance(obj!));
var wrapper = IImportScopeWrapper.FromObject(obj!);
Assert.Throws<NullReferenceException>(() => wrapper.Aliases);
}

[Fact]
public void TestIncompatibleInstance()
{
var obj = new object();
Assert.False(IImportScopeWrapper.IsInstance(obj));
Assert.Throws<InvalidCastException>(() => IImportScopeWrapper.FromObject(obj));
}
}
}

0 comments on commit 972a866

Please sign in to comment.