public void ToFeatureOwnerVm_Should_Return_FeatureOwnerVm() { User result = new User("1", DateTime.Now, "*****@*****.**", "MyFirstName", "MyLastName", null, null, true); FeatureOwnerVm actual = FeatureModelHelper.ResultToFeatureOwnerVm(result); Assert.AreEqual("MyFirstName MyLastName", actual.Name); }
public static FeatureOwnerVm ResultToFeatureOwnerVm(User result) { if (result == null) { throw new ArgumentNullException(string.Format(MessagesModel.NullValueError, "result")); } FeatureOwnerVm vm = new FeatureOwnerVm(); vm.Id = result.Id; vm.Name = result.FirstName + " " + result.LastName; return(vm); }
//TODO: Change to only return users with an owner role. public ICollection <FeatureOwnerVm> GetFeatureOwners(GetFeatureOwnersQuery query) { if (query == null) { throw new ArgumentNullException(string.Format(MessagesModel.NullValueError, "query")); } ICollection <FeatureOwnerVm> owners = new List <FeatureOwnerVm>(); GetFeatureOwnersQueryResult results = this.queryDispatcher.Dispatch <GetFeatureOwnersQuery, GetFeatureOwnersQueryResult, User>(query); foreach (var user in results.Owners) { FeatureOwnerVm owner = FeatureModelHelper.ResultToFeatureOwnerVm(user); owners.Add(owner); } return(owners); }
public void ToFeatureOwnerVm_Should_Throw_Exception_When_Result_Is_Null() { User result = null; FeatureOwnerVm actual = FeatureModelHelper.ResultToFeatureOwnerVm(result); }