コード例 #1
0
 public void PropertyThatDoesNotExist()
 {
     var logger = Substitute.For<Logger>();
     var reader = new DependsOnDataAttributeReader(null, logger);
     var node = new TypeNode
                    {
                        TypeDefinition = DefinitionFinder.FindType<ClassWithInvalidDepends>(),
                    };
     reader.Process(node);
     logger.Received().LogError("Could not find property 'NotAProperty2' for DependsOnAttribute assinged to 'FullName'.");
     logger.Received().LogError("Could not find property 'NotAProperty1' for DependsOnAttribute assinged to 'FullName'.");
 }
    public void PropertyThatDoesNotExist()
    {
        var logger = Substitute.For <Logger>();
        var reader = new DependsOnDataAttributeReader(null, logger);
        var node   = new TypeNode
        {
            TypeDefinition = DefinitionFinder.FindType <ClassWithInvalidDepends>(),
        };

        reader.Process(node);
        logger.Received().LogError("Could not find property 'NotAProperty2' for DependsOnAttribute assinged to 'FullName'.");
        logger.Received().LogError("Could not find property 'NotAProperty1' for DependsOnAttribute assinged to 'FullName'.");
    }
コード例 #3
0
    public void Integration()
    {
        var reader = new DependsOnDataAttributeReader(null, null);
        var node = new TypeNode
                       {
                           TypeDefinition = DefinitionFinder.FindType<Person>()
                       };
        reader.Process(node);

        Assert.AreEqual("FullName", node.PropertyDependencies[0].ShouldAlsoNotifyFor.Name);
        Assert.AreEqual("GivenNames", node.PropertyDependencies[0].WhenPropertyIsSet.Name);
        Assert.AreEqual("FullName", node.PropertyDependencies[1].ShouldAlsoNotifyFor.Name);
        Assert.AreEqual("FamilyName", node.PropertyDependencies[1].WhenPropertyIsSet.Name);
    }
    public void Integration()
    {
        var reader = new DependsOnDataAttributeReader(null, null);
        var node   = new TypeNode
        {
            TypeDefinition = DefinitionFinder.FindType <Person>()
        };

        reader.Process(node);

        Assert.AreEqual("FullName", node.PropertyDependencies[0].ShouldAlsoNotifyFor.Name);
        Assert.AreEqual("GivenNames", node.PropertyDependencies[0].WhenPropertyIsSet.Name);
        Assert.AreEqual("FullName", node.PropertyDependencies[1].ShouldAlsoNotifyFor.Name);
        Assert.AreEqual("FamilyName", node.PropertyDependencies[1].WhenPropertyIsSet.Name);
    }