Example #1
0
        public void TestRequirementWithInheritedPropertyMet()
        {
            var request = new GroupUserCallForwardingSettingsGetListRequest()
            {
                ServiceProviderId     = "SP",
                GroupId               = "GRP",
                CallForwardingService = CallForwardingService.CallForwardingAlways,
                ResponsePagingControl = new ResponsePagingControl
                {
                    ResponsePageSize   = 10,
                    ResponseStartIndex = 1
                },
                SortByExtension = new SortByExtension
                {
                    IsAscending     = false,
                    IsCaseSensitive = false
                }
            };

            var results = Validator.Validate(request);

            Assert.True(results.Success);
        }
        public void SerializeWithInheritedProperties()
        {
            var request = new GroupUserCallForwardingSettingsGetListRequest()
            {
                ServiceProviderId     = "SP",
                GroupId               = "GRP",
                CallForwardingService = CallForwardingService.CallForwardingAlways,
                ResponsePagingControl = new ResponsePagingControl
                {
                    ResponsePageSize   = 10,
                    ResponseStartIndex = 1
                },
                SortByExtension = new SortByExtension
                {
                    IsAscending     = false,
                    IsCaseSensitive = false
                }
            };

            var document = new BroadsoftDocument <GroupUserCallForwardingSettingsGetListRequest>()
            {
                SessionId = "acbdf1234567890",
                Protocol  = "OCI",
                Command   = new List <GroupUserCallForwardingSettingsGetListRequest>()
                {
                    request
                }
            };

            var xml = _serializer.Serialize(document);

            var diff =
                DiffBuilder.Compare(Input.FromFile(@"test-data/GroupUserCallForwardingSettingsGetListRequest.xml"))
                .WithTest(xml).Build();

            Assert.False(diff.HasDifferences());
        }
Example #3
0
        public void TestRequirementWithInheritedPropertyNotMet()
        {
            var request = new GroupUserCallForwardingSettingsGetListRequest()
            {
                ServiceProviderId     = "SP",
                GroupId               = "GRP",
                CallForwardingService = CallForwardingService.CallForwardingAlways,
                ResponsePagingControl = new ResponsePagingControl
                {
                    ResponsePageSize   = 10,
                    ResponseStartIndex = 1
                },
                SortByExtension = new SortByExtension
                {
                    IsAscending = false
                                  // Missing isCaseSensitive
                }
            };

            var results = Validator.Validate(request);

            Assert.False(results.Success);
            Assert.IsType <FieldNotSetError>(results.Errors.Single());
        }