Beispiel #1
0
        public void ShouldBe_IDbModel()
        {
            var gameProfile = new GameDetails();

            var result = gameProfile.GetType().GetInterfaces().Any(x => x == typeof(IDbModel));

            Assert.True(result);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
            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);
            }
Beispiel #4
0
        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);
        }