public void Constructor_Should_Throw_Exception_When_User_Is_Invalid() { //Arrange _builder.WithId(0); //Assert Assert.Throws <InvalidUserException>(() => _builder.Build()); }
public async Task GetCoin_ReturnsBadRequestObjectResponse_GivenFieldParameterWithNoId() { //Arrange string mediaType = "application/json+hateoas"; Guid id = new Guid("4a9522da-66f9-4dfb-88b8-f92b950d1df1"); var user = _builder.WithId(id).WithUserName("Ryan").Build(); resourceParameters.Fields = "UserName"; _mockUserService .Setup(u => u.FindUserById(id)) .ReturnsAsync(user); //Act var response = await _controller.GetUser(id, resourceParameters.Fields, mediaType); //Assert Assert.IsType <BadRequestObjectResult>(response); }
private IEnumerable <User> GetUsersTestData() { var data = new List <User>(); for (int i = 0; i < DefaultValues.ListSize; i++) { var dataBuilder = new UserTestBuilder(); data.Add(dataBuilder .WithId(new Guid()) .WithDefault() .Build()); } data.Add(new User() { Id = UserDefaultValues.DefaultId, Email = UserDefaultValues.DefaultEmail, PasswordHash = UserDefaultValues.DefaultString, RoleId = UserDefaultValues.DefaultRoleId, }); return(data.AsEnumerable()); }