public void ShouldBe_IDbModel() { var gameProfile = new GameDetails(); var result = gameProfile.GetType().GetInterfaces().Any(x => x == typeof(IDbModel)); Assert.True(result); }
public void HaveMaxLengthAttribute() { var gameProfile = new GameDetails(); var result = gameProfile .GetType() .GetProperty("Name") .GetCustomAttributes(false) .Where(x => x.GetType() == typeof(MaxLengthAttribute)) .Any(); Assert.True(result); }
public void HaveRequiredAttribute() { var gameProfile = new GameDetails(); var result = gameProfile .GetType() .GetProperty("Description") .GetCustomAttributes(false) .Where(x => x.GetType() == typeof(RequiredAttribute)) .Any(); Assert.True(result); }
public void HaveMaxLengthAttribute_WithRightValue() { var gameProfile = new GameDetails(); var result = gameProfile .GetType() .GetProperty("Name") .GetCustomAttributes(false) .Where(x => x.GetType() == typeof(MaxLengthAttribute)) .Select(x => (MaxLengthAttribute)x) .SingleOrDefault(); Assert.IsNotNull(result); Assert.AreEqual(ValidationConstants.GameProfileNameMaxLength, result.Length); }