Skip to content

Commit

Permalink
Move explicit tests to issue #201.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanLarsson committed Jul 19, 2018
1 parent b85bf5a commit 8e50613
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 96 deletions.
48 changes: 0 additions & 48 deletions WpfAnalyzers.Test/WPF0020CastValueToCorrectTypeTests/CodeFix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -645,54 +645,6 @@ private static void OnValueChanged(DependencyObject d, DependencyPropertyChanged
var value = (int)e.NewValue;
}
}
}";
AnalyzerAssert.CodeFix(Analyzer, Fix, ExpectedDiagnostic, testCode, fixedCode);
}

[Explicit("Not handling this yet, will be a bit messy as we need to get the type from the overridden property.")]
[Test]
public void DependencyPropertyOverrideMetadata()
{
var testCode = @"
namespace RoslynSandbox
{
using System.Windows;
using System.Windows.Controls;
public class FooControl : UserControl
{
static FooControl()
{
BackgroundProperty.OverrideMetadata(typeof(FooControl),
new FrameworkPropertyMetadata(null, OnValueChanged));
}
private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var value = (↓string)e.NewValue;
}
}
}";

var fixedCode = @"
namespace RoslynSandbox
{
using System.Windows;
using System.Windows.Controls;
public class FooControl : UserControl
{
static FooControl()
{
BackgroundProperty.OverrideMetadata(typeof(FooControl),
new FrameworkPropertyMetadata(null, OnBackgroundChanged));
}
private static void OnBackgroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var value = (↓string)e.NewValue;
}
}
}";
AnalyzerAssert.CodeFix(Analyzer, Fix, ExpectedDiagnostic, testCode, fixedCode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,54 +498,6 @@ private static void OnValueChanged(DependencyObject d, DependencyPropertyChanged
var value = (string)e.NewValue;
}
}
}";
AnalyzerAssert.CodeFix(Analyzer, Fix, ExpectedDiagnostic, testCode, fixedCode);
}

[Explicit("Not handling this yet, will be a bit messy as we need to get the type from the overridden property.")]
[Test]
public void DependencyPropertyOverrideMetadata()
{
var testCode = @"
namespace RoslynSandbox
{
using System.Windows;
using System.Windows.Controls;
public class FooControl : UserControl
{
static FooControl()
{
BackgroundProperty.OverrideMetadata(typeof(FooControl),
new FrameworkPropertyMetadata(null, OnValueChanged));
}
private static void OnValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var value = (↓int)e.NewValue;
}
}
}";

var fixedCode = @"
namespace RoslynSandbox
{
using System.Windows;
using System.Windows.Controls;
public class FooControl : UserControl
{
static FooControl()
{
BackgroundProperty.OverrideMetadata(typeof(FooControl),
new FrameworkPropertyMetadata(null, OnBackgroundChanged));
}
private static void OnBackgroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var value = (↓System.Collections.IEnumerable)e.NewValue;
}
}
}";
AnalyzerAssert.CodeFix(Analyzer, Fix, ExpectedDiagnostic, testCode, fixedCode);
}
Expand Down

0 comments on commit 8e50613

Please sign in to comment.