This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace ScratchPadTest | |
{ | |
[TestClass] | |
public class IntegrationTest | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace ScratchPadTest | |
{ | |
public static class ExtendedAssert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Window x:Class="WpfScratchpad.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
Title="MainWindow" Height="350" Width="525"> | |
<StackPanel> | |
<ComboBox Width="150" ItemsSource="{Binding Options}" DropDownOpened="HandleDropDownOpened" SelectedIndex="0" IsEditable="False" /> | |
<Button Content="Exit" Click="HandleButtonClick" HorizontalAlignment="Left" Margin="334,256,0,0" VerticalAlignment="Top" Width="75"/> | |
</StackPanel> | |
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Data; | |
using System.Windows.Documents; | |
using System.Windows.Input; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Collections.ObjectModel; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Windows.Controls; | |
namespace WpfScratchpad | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace CodeReadability | |
{ | |
public class CyclomaticComplexity | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static ISetup<T, TResult> Setup<T, TResult>(this T mock, Expression<Func<T, TResult>> expression) where T : class | |
{ | |
return Mock.Get(mock).Setup(expression); | |
} | |
public static void Verify<T, TResult>(this T mock, Expression<Func<T, TResult>> expression) where T : class | |
{ | |
Mock.Get(mock).Verify(expression); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private ISomeService Service { get; set; } | |
[TestMethod, Owner("ebd"), TestCategory("Proven"), TestCategory("Unit")] | |
public void SomeTest() | |
{ | |
Service = Mock.Of<ISomeService>(); | |
//I want to inject it as if it were just some service | |
Target = new SomeClassUnderTest(Service); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private ISomeService Service { get; set; } | |
[TestMethod, Owner("ebd"), TestCategory("Proven"), TestCategory("Unit")] | |
public void SomeTest() | |
{ | |
//I want to inject it as if it were just some service | |
Target = new ContractUpdater(Service); | |
//And set it up more intuitively | |
Service.Setup(serv => serv.Create(It.IsAny<Service>())).Throws(new Exception()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SomeClass | |
{ | |
private readonly List<Customer> _customers = new List<Customer>(); | |
public void AddCustomerForModelIfValid(CustomerModel modelOfCustomer) | |
{ | |
if (IsModelValidForAdding(modelOfCustomer)) | |
AddCustomerForModel(modelOfCustomer); | |
} |