public async Task HandleWithValidCreateRequestCallSaveAsExpectedResultAsync() { // Arrange var userModel = new UserModel { Id = 1, FirstName = "Thirumalai", PhoneNumber = 123456, Email = "*****@*****.**", Password = "******" }; var config = new MapperConfiguration(m => { m.CreateMap <UserDetail, UserModel>(); }); var mapper = new Mapper(config); var bookingList = MockUserListResponse().ToList().AsQueryable(); repository = new Mock <IRepository>(); repository.Setup(m => m.Query <UserDetail>()) .Returns(bookingList); underTest = new LoginUser(repository.Object, mapper); request = new LoginUserRequest(userModel); // Act CancellationToken cancellationToken; var result = await underTest.Handle(request, cancellationToken); // Assert Assert.NotNull(result); Assert.Equal(userModel.Id, result.Id); Assert.Equal(userModel.FirstName, result.FirstName); }