public async Task CreateUser_With_Duplicated_Email_Should_Return_Validation_Error() { var response = await Some.UserService(Some.MockedContext().With(Some.User().With(userName: "******", email: "*****@*****.**").ToList())) .CreateUserAsync(Some.CreateUserCommand().With(userName: "******", email: "*****@*****.**")); response.ValidationResult.Errors.Should().ContainKey(PropertyName.Get((CreateUserCommand x) => x.Email)); }
public async Task User_Should_Be_Saved_Correctly() { var context = new PersistenceContext().ResetDbState(); var userRepository = new Repository <User>(context); User newUser = Some.User(); await new UnitOfWork(context).DoAsync(work => { userRepository.Add(newUser); }); userRepository.GetById(newUser.Id).ShouldBeEquivalentTo(newUser); }