コード例 #1
0
        public async Task AcknowledgeAsync()
        {
            var condition = new AcknowledgeableCondition();
            var comment   = new LocalizedText("Comment");
            var response  = new CallResponse
            {
                Results = new CallMethodResult[]
                {
                    new CallMethodResult
                    {
                        StatusCode = StatusCodes.BadAttributeIdInvalid
                    }
                }
            };
            var channel = new TestRequestChannel(response);

            var ret = await channel.AcknowledgeAsync(condition, comment);

            ret
            .Should().Be((StatusCode)StatusCodes.BadAttributeIdInvalid);

            channel.Request
            .Should().BeEquivalentTo(new
            {
                MethodsToCall = new[]
                {
                    new
                    {
                        ObjectId       = condition.ConditionId,
                        MethodId       = NodeId.Parse(MethodIds.AcknowledgeableConditionType_Acknowledge),
                        InputArguments = new Variant[] { condition.EventId, comment }
                    }
                }
            });
        }