CheckForErrors() public method

public CheckForErrors ( PropertyData, propertyData, bool isBeforeAfter ) : string
propertyData PropertyData,
isBeforeAfter bool
return string
コード例 #1
0
        public void WhenHttpResponseContainsBadUserErrorItIsDetectedAndAInvalidApiRequestIsThrown()
        {
            var response = new HttpResponseMessage(HttpStatusCode.BadRequest)
            {
                Content = new StringContent(BadUsernameOrPasswordResponseMessage)
            };

            ErrorChecker.CheckForErrors(response);
        }
コード例 #2
0
    public void NonAbstract()
    {
        var checker = new ErrorChecker(null, null);
        var propertyDefinition = DefinitionFinder.FindType<BaseClass>().Properties.First(x => x.Name == "NonAbstractProperty");

        var message = checker.CheckForErrors(new PropertyData
                                                              {
                                                                  PropertyDefinition = propertyDefinition,
                                                                  NotificationAddedDirectly = false
                                                              }, false);
        Assert.IsNull(message);
    }
コード例 #3
0
    public void IsAbstract()
    {
        var checker = new ErrorChecker(null, null);
        var propertyDefinition = DefinitionFinder.FindType<IndexerClass>().Properties.First();

        var message = checker.CheckForErrors(new PropertyData
                                                              {
                                                                  PropertyDefinition = propertyDefinition,
                                                                  NotificationAddedDirectly = true
                                                              }, false);
        Assert.IsNotNull(message);
    }
コード例 #4
0
    public void IsAbstract()
    {
        var checker            = new ErrorChecker(null, null);
        var propertyDefinition = DefinitionFinder.FindType <IndexerClass>().Properties.First();

        var message = checker.CheckForErrors(new PropertyData
        {
            PropertyDefinition        = propertyDefinition,
            NotificationAddedDirectly = true
        }, false);

        Assert.IsNotNull(message);
    }
    public void WithGet()
    {
        var checker = new ErrorChecker(null, null);

        var propertyDefinition = DefinitionFinder.FindProperty<BeforeAfterWithNoGetErrorCheckerTest>("PropertyWithGet");

        var message = checker.CheckForErrors(new PropertyData
                                                {
                                                    PropertyDefinition = propertyDefinition,
                                                    NotificationAddedDirectly = true,
                                                }, true);
        Assert.IsNull(message);
    }
コード例 #6
0
    public void NonAbstract()
    {
        var checker            = new ErrorChecker(null, null);
        var propertyDefinition = DefinitionFinder.FindType <BaseClass>().Properties.First(x => x.Name == "NonAbstractProperty");

        var message = checker.CheckForErrors(new PropertyData
        {
            PropertyDefinition        = propertyDefinition,
            NotificationAddedDirectly = false
        }, false);

        Assert.IsNull(message);
    }
コード例 #7
0
    public void WithGet()
    {
        var checker = new ErrorChecker(null, null);

        var propertyDefinition = DefinitionFinder.FindProperty <BeforeAfterWithNoGetErrorCheckerTest>("PropertyWithGet");

        var message = checker.CheckForErrors(new PropertyData
        {
            PropertyDefinition        = propertyDefinition,
            NotificationAddedDirectly = true,
        }, true);

        Assert.IsNull(message);
    }
    public void WithBackingField()
    {
        var checker = new ErrorChecker(null, null);
        var propertyDefinition = DefinitionFinder.FindProperty(() => WithBackingFieldProperty);

        var message = checker.CheckForErrors(new PropertyData
                                                {
                                                    PropertyDefinition = propertyDefinition,
                                                    NotificationAddedDirectly = true,
                                                    CheckForEquality = true,
                                                    BackingFieldReference = propertyDefinition.DeclaringType.Fields[0],
                                                }, false);
        Assert.IsNull(message);
    }
    public void WithBackingField()
    {
        var checker            = new ErrorChecker(null, null);
        var propertyDefinition = DefinitionFinder.FindProperty(() => WithBackingFieldProperty);

        var message = checker.CheckForErrors(new PropertyData
        {
            PropertyDefinition        = propertyDefinition,
            NotificationAddedDirectly = true,
            CheckForEquality          = true,
            BackingFieldReference     = propertyDefinition.DeclaringType.Fields[0],
        }, false);

        Assert.IsNull(message);
    }
    public void WithoutBackingField()
    {
        var checker = new ErrorChecker(null, null);

        var propertyDefinition = DefinitionFinder.FindProperty <CheckForEqualityWithNoBackingFieldSetErrorCheckerTest>("WithoutBackingFieldProperty");

        var message = checker.CheckForErrors(new PropertyData
        {
            PropertyDefinition        = propertyDefinition,
            NotificationAddedDirectly = true,
            CheckForEquality          = true,
            BackingFieldReference     = null,
        }, false);

        Assert.IsNotNull(message);
    }
    public void WithoutBackingField()
    {
        var checker = new ErrorChecker(null, null);

        var propertyDefinition = DefinitionFinder.FindProperty<CheckForEqualityWithNoBackingFieldSetErrorCheckerTest>("WithoutBackingFieldProperty");

        var message = checker.CheckForErrors(new PropertyData
                                                {
                                                    PropertyDefinition = propertyDefinition,
                                                    NotificationAddedDirectly = true,
                                                    CheckForEquality = true,
                                                    BackingFieldReference = null,

                                                }, false);
        Assert.IsNotNull(message);
    }