Пример #1
0
        private static void TestSingle(MemberRequiredComponent memberRequiredComponent, string memberName)
        {
            var entity = new Entity("Test");

            entity.Add(memberRequiredComponent);

            var check  = new RequiredMembersCheck();
            var result = new AssetCompilerResult();

            Assert.True(check.AppliesTo(memberRequiredComponent.GetType()));
            check.Check(memberRequiredComponent, entity, null, "", result);
            Assert.Collection(result.Messages, (msg) =>
            {
                Assert.Equal(Core.Diagnostics.LogMessageType.Warning, msg.Type);
                Assert.Contains(memberName, msg.Text);
            });
        }
Пример #2
0
        void EntityIsNotMissingRequiredMembers()
        {
            var memberRequiredComponent = new MemberRequiredComponent(new object(), new object())
            {
                PublicProp  = new object(),
                PublicField = new object()
            };
            var entity = new Entity("test");

            entity.Add(memberRequiredComponent);

            var check  = new RequiredMembersCheck();
            var result = new AssetCompilerResult();

            Assert.True(check.AppliesTo(memberRequiredComponent.GetType()));
            check.Check(memberRequiredComponent, entity, null, "", result);
            Assert.Empty(result.Messages);
        }
Пример #3
0
        void EntityIsMissingAllRequiredMembers()
        {
            var memberRequiredComponent = new MemberRequiredComponent(null, null)
            {
                PublicProp  = null,
                PublicField = null
            };
            var entity = new Entity("test");

            entity.Add(memberRequiredComponent);

            var check  = new RequiredMembersCheck();
            var result = new AssetCompilerResult();

            Assert.True(check.AppliesTo(memberRequiredComponent.GetType()));
            check.Check(memberRequiredComponent, entity, null, "", result);
            Assert.Equal(4, result.Messages.Count);
        }