Ejemplo n.º 1
0
        public void ShouldGetTwoProblemsWithDoubleTwinsOperations()
        {
            DuplicatedOperations rule = new DuplicatedOperations();

            rule.Check(RuleHelper.GetTypeNodeFromType(typeof(IDuplicateOperations)));
            Assert.AreEqual(2, rule.Problems.Count);
        }
Ejemplo n.º 2
0
        public void ShouldGetOneProblemWithNoParametersDeclared()
        {
            NonEmptyCallbackContractType rule = new NonEmptyCallbackContractType();

            rule.Check(RuleHelper.GetTypeNodeFromType(typeof(INonEmptyCallbackContractType)));

            Assert.AreEqual(1, rule.Problems.Count);
        }
        public void ShouldGetOneProblemWithNoParametersDeclared()
        {
            NonEmptyServiceContract rule = new NonEmptyServiceContract();

            rule.Check(RuleHelper.GetTypeNodeFromType(typeof(INoDefinedNameInServiceContract)));

            Assert.AreEqual(1, rule.Problems.Count);
        }
        public void ShouldGetNoProblemWithValidContract()
        {
            InvalidCallbackContractType rule = new InvalidCallbackContractType();

            rule.Check(RuleHelper.GetTypeNodeFromType(typeof(IValidServiceContract)));

            Assert.AreEqual(0, rule.Problems.Count);
        }
Ejemplo n.º 5
0
        public void ShouldGetNoProblemWithNoRuleViolationOnOperationContract()
        {
            ReviewProtectionLevel rule = new ReviewProtectionLevel();
            TypeNode typeNode          = RuleHelper.GetTypeNodeFromType(typeof(IHelloWorld2));

            rule.VisitAttributes(typeNode.GetMembersNamed(Identifier.For("HelloWorld"))[0].Attributes);
            Assert.AreEqual(0, rule.Problems.Count);
        }
Ejemplo n.º 6
0
        public void ShouldGetNoProblemWithNoRuleViolationOnServiceContract()
        {
            ReviewProtectionLevel rule = new ReviewProtectionLevel();
            TypeNode typeNode          = RuleHelper.GetTypeNodeFromType(typeof(IHelloWorld2));

            rule.VisitAttributes(typeNode.Attributes);
            Assert.AreEqual(0, rule.Problems.Count);
        }
        public void ShouldGetOneProblemWithFaultOnOneWayOperation()
        {
            NoFaultsWithOneWayOperation rule = new NoFaultsWithOneWayOperation();
            TypeNode typeNode = RuleHelper.GetTypeNodeFromType(typeof(IFaultsWithOneWayOperation));

            rule.Check(typeNode.GetMembersNamed(Identifier.For("Operation"))[0]);

            Assert.AreEqual(1, rule.Problems.Count);
        }
        public void ShouldGetNoProblemWithVoidReturn()
        {
            MixingMessageContractAttributes rule = new MixingMessageContractAttributes();
            TypeNode typeNode = RuleHelper.GetTypeNodeFromType(typeof(IMixingMessageContractAttributes));

            rule.Check(typeNode.GetMembersNamed(Identifier.For("Operation4"))[0]);

            Assert.AreEqual(0, rule.Problems.Count);
        }
        public void ShouldGetOneProblemWhenIssueInFirstParam()
        {
            MixingMessageContractAttributes rule = new MixingMessageContractAttributes();
            TypeNode typeNode = RuleHelper.GetTypeNodeFromType(typeof(IMixingMessageContractAttributes));

            rule.Check(typeNode.GetMembersNamed(Identifier.For("Operation3"))[0]);

            Assert.AreEqual(1, rule.Problems.Count);
        }
        public void ShouldGetOneProblemWithReplyActionWithOneWayOperation()
        {
            NoReplyActionWithOneWayOperation rule = new NoReplyActionWithOneWayOperation();
            TypeNode typeNode = RuleHelper.GetTypeNodeFromType(typeof(IReplyActionWithOneWay));

            rule.Check(RuleHelper.GetMemberForOperation(typeNode, "Operation"));

            Assert.AreEqual(1, rule.Problems.Count);
        }
Ejemplo n.º 11
0
        public void ShouldGetOneProblemWithBadOperationBehaviorUsage()
        {
            ReturnVoidWithOneWayOperation rule = new ReturnVoidWithOneWayOperation();
            TypeNode typeNode = RuleHelper.GetTypeNodeFromType(typeof(IReturnVoidWithOneWay));

            rule.Check(typeNode.GetMembersNamed(Identifier.For("Operation"))[0]);

            Assert.AreEqual(1, rule.Problems.Count);
        }
Ejemplo n.º 12
0
        public void ShouldGetOneProblemWithNoOperationContractValuesDeclared()
        {
            InconsistentServiceContract rule = new InconsistentServiceContract();
            TypeNode typeNode = RuleHelper.GetTypeNodeFromType(typeof(INoOperationContractValuesDeclared));

            rule.Check(typeNode);
            Assert.AreEqual(0, rule.Problems.Count);

            rule.Check(RuleHelper.GetMemberForOperation(typeNode, "Operation"));
            Assert.AreEqual(1, rule.Problems.Count);
        }
Ejemplo n.º 13
0
        public void ShouldGetOneProblemWithNotAllowedSessionDeclared()
        {
            InconsistentServiceContract rule = new InconsistentServiceContract();
            TypeNode typeNode = RuleHelper.GetTypeNodeFromType(typeof(INotAllowedSessionDeclared));

            rule.Check(typeNode);

            Assert.AreEqual(0, rule.Problems.Count);

            rule.Check(RuleHelper.GetMemberForOperation(typeNode, "Operation"));
            Assert.AreEqual(1, rule.Problems.Count);
            Assert.AreEqual("remove", rule.Problems[0].Resolution.Items[0]);
        }
        public void ShouldResetUnmatchedMessageHandlerFlag()
        {
            MultipleUnmatchedMessageHandlers rule = new MultipleUnmatchedMessageHandlers();
            TypeNode typeNode = RuleHelper.GetTypeNodeFromType(typeof(IMultipleUnmatchedMessageHandlers));

            rule.Check(RuleHelper.GetMemberForOperation(typeNode, "Operation1"));
            rule.Check(RuleHelper.GetMemberForOperation(typeNode, "Operation3"));

            Assert.AreEqual(1, rule.Problems.Count);
            rule.Check(typeNode);

            rule.Check(RuleHelper.GetMemberForOperation(typeNode, "Operation1"));
            Assert.AreEqual(1, rule.Problems.Count);
        }