Skip to content

Instantly share code, notes, and snippets.

@msarchet
Created June 24, 2016 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msarchet/a5b39be02337b5e7b517bbe5dd26be9d to your computer and use it in GitHub Desktop.
Save msarchet/a5b39be02337b5e7b517bbe5dd26be9d to your computer and use it in GitHub Desktop.
Template-10-UnitTest-Failure
<UserControl
x:Class="DebugCheck.Views.Test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DebugCheck.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">
<Grid>
</Grid>
</UserControl>
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
namespace DebugCheck.Views
{
public sealed partial class Test : UserControl
{
public string Text
{
get { return (string)GetValue(TextProperty);}
set { SetValue(TextProperty, value); }
}
public static readonly DependencyProperty TextProperty =
DependencyProperty.Register(nameof(Text), typeof(string), typeof(Test), new PropertyMetadata(null));
public Test()
{
this.InitializeComponent();
}
}
}
//
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework.AppContainer;
namespace DebugCheck.Test
{
[TestClass]
public class UnitTest1
{
[UITestMethod]
public void TestMethod1()
{
var testView = new DebugCheck.Views.Test();
testView.Text = "yay";
Microsoft.VisualStudio.TestPlatform.UnitTestFramework.Assert.AreEqual(testView.Text, "Yay");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment