Created
January 7, 2011 11:51
-
-
Save jfromaniello/769385 to your computer and use it in GitHub Desktop.
This file contains hidden or 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.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