Skip to content

Instantly share code, notes, and snippets.

View k0stya's full-sized avatar

Kostiantyn Khomenko k0stya

View GitHub Profile
@k0stya
k0stya / Test doubles - Test-Specific Object - testing protected members.cs
Last active December 14, 2015 03:09
If the system under test (SUT) was not designed specifically to be testable, we may find that the test cannot get access to state that it must initialize or verify at some point in the test.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
namespace TestDoubles.Examples.TestSpecificSubclass.ProtectedMember
{
[TestClass]
public class Player_Test
{
[TestMethod]
public void Should_be_able_to_roll_die_wtih_max_face_value()
@k0stya
k0stya / AspNetDevelopmentServerAttribute Example.cs
Last active December 12, 2015 10:39
Helper class that allows to do integration testing of WCF services using AspNetDevelopmentServerAttribute.
// Example of usage
[TestMethod]
[AspNetDevelopmentServer("WcfService", "Physical path to your WCF project")]
public void TestMethod1()
{
ServiceClient target = new ServiceClient();
Assert.IsTrue(WcfWebServiceHelper.TryUrlRedirection(target, TestContext, "WcfService"));
int value = 0;
string expected = "You entered: 0";
string actual;