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); }); }
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); }
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); }