Exemplo n.º 1
0
        public void MapModelToEntity_Returns_Tuple_Of_Entities_When_Given_Valid_Model()
        {
            var entities = _mapper.MapModelToEntity(new UserModel(_testUser, _testUserProfile));

            Assert.That(entities.Item1, Is.Not.Null.And.InstanceOf <IUser>());
            Assert.That(entities.Item2, Is.Not.Null.And.InstanceOf <IUserProfile>());

            Assert.AreEqual(entities.Item1, _testUser,
                            $"{nameof(entities.Item1)}: {entities.Item1.GetHashCode()} != {nameof(_testUser)}: {_testUser.GetHashCode()}");

            Assert.AreEqual(entities.Item2, _testUserProfile,
                            $"{nameof(entities.Item2)}: {entities.Item2.GetHashCode()} != {nameof(_testUserProfile)}: {_testUserProfile.GetHashCode()}");
        }
 public void Delete(IUserModel model)
 {
     (IUser User, IUserProfile UserProfile)entities = _mapper.MapModelToEntity(model);
     _userRepository.Delete(entities.User);
     _userProfileRepository.Delete(entities.UserProfile);
 }