Esempio n. 1
0
        public void V2_35_00_Request_LoginName_Ordering_Test2()
        {
            // Arrange
            var builder1 = UserAuthRequest_Type.CreateBuilder()
                           .UserPswd(new UserPswd_Type {
                CryptType = "asdf"
            })
                           .UserLoginName("testname")
                           .UserDomain("workspace");

            var builder = TXLife_Type.CreateBuilder()
                          .Version("2.35.00")
                          .AddUserAuthRequest(builder1.Build());

            var txLife = builder.Build();

            // Act
            string xmlString;

            txLife.Serialize(out xmlString);

            // Assert
            var authRequestIndex = xmlString.IndexOf("<UserAuthRequest>");
            var loginIndex       = xmlString.IndexOf("<UserLoginName>testname</UserLoginName>");
            var pswdIndex        = xmlString.IndexOf("<UserPswd>");

            // Ensures the user login appears first
            Assert.True(loginIndex < pswdIndex);
        }
        public void V2_36_00_Request_LoginName_Ordering_Test1()
        {
            // Arrange
            var builder1 = UserAuthRequest_Type.CreateBuilder()
                           .UserAuthentication(new UserAuthentication_Type {
                id = "512"
            })
                           .UserLoginName("testname")
                           .UserDomain("workspace");

            var builder = TXLife_Type.CreateBuilder()
                          .Version("2.38.00")
                          .AddUserAuthRequest(builder1.Build());

            var txLife = builder.Build();

            // Act
            string xmlString;

            txLife.Serialize(out xmlString);

            // Assert
            var authRequestIndex = xmlString.IndexOf("<UserAuthRequest>");
            var loginIndex       = xmlString.IndexOf("<UserLoginName>testname</UserLoginName>");
            var authIndex        = xmlString.IndexOf("<UserAuthentication id=\"512\" />");

            // Ensures the user login appears first
            Assert.True(loginIndex < authIndex);
        }
        public void V2_38_00_UserAuthRequest_Builder_Test1()
        {
            // Arrange
            var builder = TXLife_Type.CreateBuilder()
                          .AddTXLifeRequest(new TXLifeRequest_Type {
                id = "1"
            })
                          .AddUserAuthRequest(UserAuthRequest_Type.CreateBuilder()
                                              .UserAuthentication(new UserAuthentication_Type()
            {
                id = "testauth"
            })
                                              .UserLoginName("john"))
                          .Version("2.38.00")
                          .AddOLifEExtension(new OLifEExtension_Type()
            {
                VendorCode = "a"
            });

            var txLife = builder.Build();

            // Act
            string xmlString;

            txLife.Serialize(out xmlString);

            // Assert
            Assert.Contains("<UserAuthentication id=\"testauth\" />", xmlString);
        }
        public override UserAuthRequest_Type Build(UserAuthRequest_Type baseEntity)
        {
            var resultEntity = base.Build(baseEntity);

            BuildItemsProperty(resultEntity);

            return(resultEntity);
        }
        protected override void ValidateBaseObject(UserAuthRequest_Type baseEntity)
        {
            if (baseEntity.Items == null || baseEntity.Items.Length != 0)
            {
                throw new ArgumentException("The UserAuthRequest_Type.Items array should be empty. This builder will help handle the ACORD spec logic with setting this property.", "baseEntity");
            }

            if (baseEntity.ItemsElementName == null || baseEntity.ItemsElementName.Length != 0)
            {
                throw new ArgumentException("The UserAuthRequest_Type.ItemsElementName array should be empty. This builder will help handle the ACORD spec logic with setting this property.", "baseEntity");
            }
        }
        private void BuildItemsProperty(UserAuthRequest_Type entity)
        {
            // Ensures proper order of Items as per section 7.568
            var items            = new List <object>();
            var itemsElementName = new List <ItemsChoiceType2>();

            foreach (var type in _xmlSequenceOrder)
            {
                LinkedListNode <Action <List <object> > > currentNode = _buildActions[type].First;
                while (currentNode != null)
                {
                    currentNode.Value(items);
                    itemsElementName.Add(type);
                    currentNode = currentNode.Next;
                }
            }

            entity.Items            = items.ToArray();
            entity.ItemsElementName = itemsElementName.ToArray();
        }
Esempio n. 7
0
 public override Sans_TXLifeResponse_UserAuthResponse_UserAuthRequest_TXLifeBuilder AddUserAuthRequest(UserAuthRequest_Type request)
 {
     _buildActions[typeof(UserAuthRequest_Type)].AddLast(n => n.Items.Add(request));
     return(this);
 }
Esempio n. 8
0
 public abstract Sans_TXLifeResponse_UserAuthResponse_UserAuthRequest_TXLifeBuilder AddUserAuthRequest(UserAuthRequest_Type request);
 protected UserAuthRequestBuilder_Sans_UserAuthentication_Or_UserPswd_UserAuthRequestBuilder(UserAuthRequest_Type baseEntity) : base(baseEntity)
 {
 }
 protected UserAuthRequestBuilder_Sans_Properties_UserAuthRequestBuilder(UserAuthRequest_Type baseEntity) : base(baseEntity)
 {
 }
 protected UserAuthRequestBuilder(UserAuthRequest_Type userAuthRequest)
     : base(userAuthRequest)
 {
 }
 public static UserAuthRequestBuilder CreateBuilder(UserAuthRequest_Type userAuthRequest)
 {
     return(new UserAuthRequestBuilder(userAuthRequest));
 }
 protected UserAuthRequestBuilder_Sans_RestrictedOptions(UserAuthRequest_Type baseEntity) : base(baseEntity)
 {
 }
 protected UserAuthRequestBuilder_Sans_UserLoginName_UserAuthRequestBuilder(UserAuthRequest_Type baseEntity) : base(baseEntity)
 {
 }