Beispiel #1
0
        public void GetRxUser_ShouldReturnOkObjectResult_WhenUserExists()
        {
            // Arrange
            var RxUserId    = Guid.NewGuid();
            var RxUserFirst = "FirstName";
            var RxUserLast  = "LastName";
            var RxUser      = new RxUserModel {
                Id = RxUserId.ToString(), FirstName = RxUserFirst, LastName = RxUserLast
            };

            _RxUserService.GetById(RxUserId).Returns(RxUser);

            // Act
            var result = _sut.GetRxUser(Guid.Parse(RxUser.Id));

            // Assert
            Assert.IsType <OkObjectResult>(result);
        }
Beispiel #2
0
        public void GetById_ShouldLogAppropriateMessage_WhenCustomerExists()
        {
            // Arrange
            var RxUserId    = Guid.NewGuid();
            var RxUserFirst = "FirstName";
            var RxUserLast  = "LastName";
            var RxUserdto   = new RxUserModel {
                Id = RxUserId.ToString(), FirstName = RxUserFirst, LastName = RxUserLast
            };

            _RxUserRepository.GetById(RxUserId).Returns(RxUserdto);

            // Act
            var RxUser = _sut.GetById(RxUserId);

            // Assert
            _logger.Received(1).LogInformation("Found a user");
            _logger.DidNotReceive().LogInformation("No user found!");
        }
Beispiel #3
0
        public void GetByIdAsync_ShouldReturnUser_WhenUserExists()
        {
            var RxUserId    = Guid.NewGuid();
            var RxUserFirst = "FirstName";
            var RxUserLast  = "LastName";
            var RxUserdto   = new RxUserModel {
                Id = RxUserId.ToString(), FirstName = RxUserFirst, LastName = RxUserLast
            };

            _RxUserRepository.GetById(RxUserId).Returns(RxUserdto);

            // Act
            var RxUser = _sut.GetById(RxUserId);

            // Assert
            Assert.Equal(RxUserId.ToString(), RxUser.Id);
            Assert.Equal(RxUserFirst, RxUser.FirstName);
            Assert.Equal(RxUserLast, RxUser.LastName);
        }
Beispiel #4
0
 private RxUserModel MapToDomain(RxUserModel RxUser, Guid id)
 {
     return(new RxUserModel {
         Id = id.ToString(), FirstName = RxUser.FirstName, LastName = RxUser.LastName
     });
 }