コード例 #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);
        }
コード例 #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);
        }