Skip to content

Commit

Permalink
Move explicit tests to issue #200.
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanLarsson committed Jul 19, 2018
1 parent 17fbfac commit b85bf5a
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 @@ -693,54 +693,6 @@ private static void OnBackgroundChanged(DependencyObject d, DependencyPropertyCh
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 source property.")]
[Test]
public void DependencyPropertyAddOwner()
{
var testCode = @"
namespace RoslynSandbox
{
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
public class FooControl : FrameworkElement
{
static FooControl()
{
TextElement.FontSizeProperty.AddOwner(typeof(FooControl), new PropertyMetadata(12.0, 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;
using System.Windows.Documents;
public class FooControl : FrameworkElement
{
static FooControl()
{
TextElement.FontSizeProperty.AddOwner(typeof(FooControl), new PropertyMetadata(12.0, OnFontSizeChanged));
}
private static void OnFontSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
// nop
}
}
}";
AnalyzerAssert.CodeFix(Analyzer, Fix, ExpectedDiagnostic, testCode, fixedCode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,54 +546,6 @@ private static void OnBackgroundChanged(DependencyObject d, DependencyPropertyCh
var value = (↓System.Collections.IEnumerable)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 source property.")]
[Test]
public void DependencyPropertyAddOwner()
{
var testCode = @"
namespace RoslynSandbox
{
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
public class FooControl : FrameworkElement
{
static FooControl()
{
TextElement.FontSizeProperty.AddOwner(typeof(FooControl), new PropertyMetadata(12.0, 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;
using System.Windows.Documents;
public class FooControl : FrameworkElement
{
static FooControl()
{
TextElement.FontSizeProperty.AddOwner(typeof(FooControl), new PropertyMetadata(12.0, OnFontSizeChanged));
}
private static void OnFontSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
// nop
}
}
}";
AnalyzerAssert.CodeFix(Analyzer, Fix, ExpectedDiagnostic, testCode, fixedCode);
}
Expand Down

0 comments on commit b85bf5a

Please sign in to comment.