Beispiel #1
0
        public void Map_Test()
        {
            //Arange
            var transferLog = new TransferUserActivity
            {
                Date        = new DateTime(1, 1, 1),
                Description = "test",
                EntityState = EntityState.Unchanged,
                LogId       = 1,
                UserId      = 1,
                UserName    = "******"
            };

            var log = new UserActivity
            {
                Date        = new DateTime(1, 1, 1),
                Description = "test",
                EntityState = EntityState.Unchanged,
                LogId       = 1,
                UserId      = 1,
                UserName    = "******"
            };

            var comperableDomainLog = new ComperableDomainLog()
            {
                Date        = new DateTime(1, 1, 1),
                Description = "test",
                EntityState = EntityState.Unchanged,
                LogId       = 1,
                UserId      = 1,
                UserName    = "******"
            };

            var comperableTransferLog = new ComperableTransferLog()
            {
                Date        = new DateTime(1, 1, 1),
                Description = "test",
                EntityState = EntityState.Unchanged,
                LogId       = 1,
                UserId      = 1,
                UserName    = "******"
            };

            var mapper = new UserActivityMapper();
            //Act
            var actualTransfer = mapper.Map(log);
            var actualDomain   = mapper.Map(transferLog);

            //Assert
            Assert.That(actualDomain,
                        Is.EqualTo(comperableDomainLog));
            Assert.That(actualTransfer,
                        Is.EqualTo(comperableTransferLog));
        }
        public UserActivity Map(TransferUserActivity log)
        {
            if (log == null)
            {
                throw new ArgumentNullException("log");
            }

            return new UserActivity
            {
                Date = log.Date,
                Description = log.Description,
                EntityState = log.EntityState,
                LogId = log.LogId,
                UserId = log.UserId,
                UserName = log.UserName,
                UserRoleName = log.UserRoleName
            };
        }
        public UserActivity Map(TransferUserActivity log)
        {
            if (log == null)
            {
                throw new ArgumentNullException("log");
            }

            return(new UserActivity
            {
                Date = log.Date,
                Description = log.Description,
                EntityState = log.EntityState,
                LogId = log.LogId,
                UserId = log.UserId,
                UserName = log.UserName,
                UserRoleName = log.UserRoleName
            });
        }