예제 #1
0
        public async Task New_User_Should_Have_Name(UserInput user)
        {
            var mockUserWriteOnlyRepository = new Mock <IUserWriteOnlyRepository>();
            var sut = new UserUseCase(null, mockUserWriteOnlyRepository.Object);

            await Assert.ThrowsAsync <InvalidValueException>(() => sut.CreateUser(user));
        }
예제 #2
0
        public async Task Should_Create_User(string name)
        {
            var mockUserWriteOnlyRepository = new Mock <IUserWriteOnlyRepository>();

            mockUserWriteOnlyRepository.Setup(repo => repo.CreateUser(It.IsAny <User>()))
            .ReturnsAsync(Guid.NewGuid());

            var sut = new UserUseCase(null, mockUserWriteOnlyRepository.Object);

            var user = GetNewUser(name);

            var newUser = await sut.CreateUser(user);

            Assert.True(newUser != null);
        }