Example #1
0
        public void AsMailUser_GivenMailUserEntity_ShouldReturnMailUser()
        {
            // Act
            var user = new MailUserEntity().AsMailUser();

            // Assert
            Assert.IsNotNull(user);
            Assert.IsInstanceOf <MailUser>(user);
        }
Example #2
0
        public static void AreEqual(MailUserEntity source, MailUser target, bool checkPassword = true)
        {
            Assert.AreEqual(source.Id, target.Id);
            Assert.AreEqual(source.Enabled, target.Enabled);
            Assert.AreEqual(source.LastLoginDateUtc, target.LastLoginDateUtc);
            Assert.AreEqual(source.CreationDateUtc, target.CreationDateUtc);
            Assert.AreEqual(source.Username, target.Username);
            Assert.AreEqual(source.DisplayName, target.DisplayName);

            if (checkPassword)
            {
                Assert.AreEqual(source.Password, target.Password);
            }
        }
Example #3
0
        public static void AreEqual(MailUser source, MailUserEntity target)
        {
            if (source == null)
            {
                throw new ArgumentException("source object cannot be null");
            }

            if (target == null)
            {
                throw new ArgumentException("target object cannot be null");
            }

            Assert.AreEqual(source.Enabled, target.Enabled);
            Assert.AreEqual(source.CreationDateUtc, target.CreationDateUtc);
            Assert.AreEqual(source.DisplayName, target.DisplayName);
            Assert.AreEqual(source.Id, target.Id);
            Assert.AreEqual(source.LastLoginDateUtc, target.LastLoginDateUtc);
            Assert.AreEqual(source.Password, target.Password);
            Assert.AreEqual(source.Username, target.Username);
        }
Example #4
0
        public static MailUser AsMailUser(this MailUserEntity source, bool mapPassword = true)
        {
            if (source == null)
            {
                return(null);
            }

            var mapped = new MailUser
            {
                LastLoginDateUtc = source.LastLoginDateUtc,
                DisplayName      = source.DisplayName,
                Enabled          = source.Enabled,
                Username         = source.Username,
                Id = source.Id,
                CreationDateUtc = source.CreationDateUtc
            };

            if (mapPassword)
            {
                mapped.Password = source.Password;
            }

            return(mapped);
        }
Example #5
0
 public MailUserEntityBuilder()
 {
     _user = new MailUserEntity();
 }