public void GetUserByUserName_WhenUserDoesNotExist_ReturnNull() { var storageMock = new Mock<IEntityStorage<User>>(); storageMock.SetupGet(x => x.Entities) .Returns(new List<User>()); var dateTimeServiceMock = new Mock<IDateTimeService>(); var service = new UserService(storageMock.Object, dateTimeServiceMock.Object) as IUserService; var user = service.GetUserByUserName("non existing username"); Assert.IsNull(user); }
public void GetUserByUserName_WhenUserNameIsNullOrWhiteSpace_ThrowArgumentException(string userName) { var storageMock = new Mock<IEntityStorage<User>>(); var dateTimeServiceMock = new Mock<IDateTimeService>(); var service = new UserService(storageMock.Object, dateTimeServiceMock.Object) as IUserService; service.GetUserByUserName(userName); }