Skip to content

Instantly share code, notes, and snippets.

@jfromaniello
Created January 7, 2011 11:51
Show Gist options
  • Save jfromaniello/769385 to your computer and use it in GitHub Desktop.
Save jfromaniello/769385 to your computer and use it in GitHub Desktop.
using System;
using System.Linq;
using BCS.Shared;
using BCS.Shared.Nationalities;
using NUnit.Framework;
using SharpTestsEx;
namespace BCS.Handlers.Tests
{
[TestFixture]
public class RequestAndResponsesTests
{
[Test]
public void AllTypesShouldHaveEmptyConstructor()
{
var wrongResponses = KnownTypeHelper.GetTypesToRegister(typeof(NationalityDto).Assembly)
.Where(
t => t.GetConstructors().All(c => c.GetParameters().Count() > 0))
.ToArray();
var message = string.Format("These types must have an empty constructor {0} ",
string.Join(Environment.NewLine, wrongResponses.Select(t => t.Name)));
wrongResponses.Should(message).Be.Empty();
}
[Test]
public void AllPublicPropertiesShouldHavePublicSetter()
{
var responseInstances = KnownTypeHelper.GetTypesToRegister(typeof(NationalityDto).Assembly)
.Select(Activator.CreateInstance)
.ToArray();
foreach (var responseInstance in responseInstances)
{
responseInstance.Should().Be.DataContractSerializable();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment