public void create_a_user_if_it_doesnt_exists() { var messages = new[] { "a message" }; var post = new Post("mike", messages, _userRepository.Object, _clock.Object); _userRepository.Setup(x => x.Get("mike")).Returns(new NotExistingUser()); post.Execute(); _userRepository.Verify(x => x.Add(It.Is<User>(y => y.Name == "mike"))); }
public void add_a_bark_to_the_user() { var messages = new[] { "a message"}; var post = new Post("bob", messages, _userRepository.Object, _clock.Object); _userRepository.Setup(x => x.Get("bob")).Returns(_bob); post.Execute(); Assert.That(_bob.Barks.Any(x => x.Message == "a message"), "bark not present in user"); }