Esempio n. 1
0
        public void Convert_User_From_Wrapper_To_View_Model()
        {
            //Arrange
            var converter = new ModelConversitions();

            var model = new wrapper.User
            {
                UserId          = new Guid(),
                Forename        = "Jamie",
                Surname         = "Matthews",
                JobTitle        = "Placement Engineer",
                IsAdministrator = false,
                IsLineManager   = true,
                Email           = "*****@*****.**"
            };

            //Act
            var result = converter.ConvertUserFromWrapper(model);

            //Assert
            Assert.IsAssignableFrom <User>(result);
            Assert.AreEqual(result.UserId, model.UserId);
            Assert.AreEqual(result.Forename, model.Forename);
            Assert.AreEqual(result.Surname, model.Surname);
            Assert.AreEqual(result.JobTitle, model.JobTitle);
            Assert.AreEqual(result.IsAdministrator, model.IsAdministrator);
            Assert.AreEqual(result.IsLineManager, model.IsLineManager);
            Assert.AreEqual(result.Email, model.Email);
        }
Esempio n. 2
0
        public wrapper.User ConvertRegistrationToWrapper(RegisterModel entry)
        {
            var user = new wrapper.User
            {
                EmployeeNumber = entry.EmployeeNumber,
                Forename       = entry.Forename,
                Surname        = entry.Surname,
                Email          = entry.Email,
                JobTitle       = entry.JobTitle,
                Team           = entry.Team,
            };

            return(user);
        }
Esempio n. 3
0
        public User ConvertUserFromWrapper(wrapper.User entry)
        {
            var user = new User
            {
                UserId          = entry.UserId,
                EmployeeNumber  = entry.EmployeeNumber,
                Forename        = entry.Forename,
                Surname         = entry.Surname,
                Email           = entry.Email,
                JobTitle        = entry.JobTitle,
                IsLineManager   = entry.IsLineManager,
                IsAdministrator = entry.IsAdministrator,
            };

            return(user);
        }
Esempio n. 4
0
        public wrapper.User ConvertUserToWrapper(User entry)
        {
            var user = new wrapper.User
            {
                UserId           = entry.UserId,
                EmployeeNumber   = entry.EmployeeNumber,
                Forename         = entry.Forename,
                Surname          = entry.Surname,
                Email            = entry.Email,
                JobTitle         = entry.JobTitle,
                IsLineManager    = entry.IsLineManager,
                IsAdministrator  = entry.IsAdministrator,
                CancellationDate = entry.CancellationDate,
            };

            return(user);
        }
Esempio n. 5
0
        public ICollection <wrapper.User> ConvertDataUserListToWrapper(ICollection <data.User> entry)
        {
            var users = new List <wrapper.User>();

            foreach (data.User data in entry)
            {
                var user = new wrapper.User
                {
                    UserId          = data.UserId,
                    EmployeeNumber  = data.EmployeeNumber,
                    Forename        = data.Forename,
                    Surname         = data.Surname,
                    JobTitle        = data.JobTitle,
                    IsLineManager   = data.IsLineManager,
                    IsAdministrator = data.IsAdministrator,
                };
                users.Add(user);
            }
            ;
            return(users);
        }