Skip to content

Instantly share code, notes, and snippets.

@Vannevelj
Created January 26, 2016 22:11
Show Gist options
  • Save Vannevelj/ca710aee7b8b6ff05885 to your computer and use it in GitHub Desktop.
Save Vannevelj/ca710aee7b8b6ff05885 to your computer and use it in GitHub Desktop.
Test method VSDiagnostics.Test.Tests.General.TryCastUsingAsNotNullInsteadOfIsAsTests.TryCastWithoutUsingAsNotNull_BranchedIfStatement threw exception:
RoslynTester.Helpers.Testing.AssertionException:
Expected document is not the same as the resulting one.
Expected:
using System;
using System.Text;
namespace ConsoleApplication1
{
class MyClass
{
private int oAsInt32;
void Method(object o)
{
var oAsInt32 = o as int?;
var oAsString = o as string;
if (oAsInt32 != null)
{
}
else if(oAsString != null)
{
}
}
}
}
Actual:
using System;
using System.Text;
namespace ConsoleApplication1
{
class MyClass
{
private int oAsInt32;
void Method(object o)
{
var oAsInt32 = o as int?;
var oAsString = o as string;
if (oAsInt32 != null)
{
}
else if(oAsString != null)
{
}
}
}
}
at RoslynTester.Helpers.Testing.Assert.AreEqual(Object expected, Object actual, String message)
at RoslynTester.Helpers.CodeFixVerifier.VerifyFix(String language, DiagnosticAnalyzer analyzer, CodeFixProvider codeFixProvider, String oldSource, String newSource, Nullable`1 codeFixIndex, Boolean allowNewCompilerDiagnostics)
at RoslynTester.Helpers.CSharp.CSharpCodeFixVerifier.VerifyFix(String oldSource, String newSource, Nullable`1 codeFixIndex, Boolean allowNewCompilerDiagnostics)
at VSDiagnostics.Test.Tests.General.TryCastUsingAsNotNullInsteadOfIsAsTests.TryCastWithoutUsingAsNotNull_BranchedIfStatement() in TryCastUsingAsNotNullInsteadOfIsAsTests.cs: line 1344
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment