public AndConstraint <DictionaryInfoAssertions> HaveValueTypes(IEnumerable <BuiltinTypeId> typeIds, string because = "", params object[] reasonArgs) { var is3X = ((ModuleScope)OwnerScope.GlobalScope).Module.ProjectEntry.ProjectState.LanguageVersion.Is3x(); AssertionsUtilities.AssertTypeIds(Subject._keysAndValues.AllValueTypes, typeIds, GetName(), is3X, because, reasonArgs); return(new AndConstraint <DictionaryInfoAssertions>(this)); }
public static AndWhichConstraint <TAssertions, TMember> OfMemberType <TMember, TAssertions> (this AndWhichConstraint <TAssertions, TMember> constraint, PythonMemberType memberType, string because = "", params object[] reasonArgs) where TMember : IMember { Execute.Assertion.ForCondition(constraint.Which.MemberType == memberType) .BecauseOf(because, reasonArgs) .FailWith($"Expected {AssertionsUtilities.GetQuotedName(constraint.Which)} to have type '{memberType}', but found '{constraint.Which.MemberType}'"); return(new AndWhichConstraint <TAssertions, TMember>(constraint.And, constraint.Which)); }
public AndConstraint <SignatureInformationAssertions> OnlyHaveParameterLabels(IEnumerable <string> labels, string because = "", params object[] reasonArgs) { NotBeNull(because, reasonArgs); var actual = Subject.parameters?.Select(i => i.label).ToArray() ?? new string[0]; var expected = labels.ToArray(); var errorMessage = AssertionsUtilities.GetAssertCollectionOnlyContainsMessage(actual, expected, $"signature '{Subject.label}'", "parameter label", "parameter labels"); Execute.Assertion.ForCondition(errorMessage == null) .BecauseOf(because, reasonArgs) .FailWith(errorMessage); return(new AndConstraint <SignatureInformationAssertions>(this)); }