Exemplo n.º 1
0
        public void RetrievesUsersThatExist()
        {
            var spy = new UserRepositorySpy();
            var command = new CreateOrRetrieveUserByName(spy);

            var user = command.Execute("Alice");

            Assert.Null(spy.AddCalledWith);
            Assert.Equal("Alice", user.Name);
        }
Exemplo n.º 2
0
        public void CreatesAUserIfNotExisting()
        {
            var spy = new UserRepositorySpy();
            var command = new CreateOrRetrieveUserByName(spy);

            var user = command.Execute("Bob");

            Assert.Equal("Bob", spy.AddCalledWith.Name);
            Assert.Equal("Bob", user.Name);
        }