Beispiel #1
0
        public async Task UserCommandService_CreateUser_Success([Frozen] Mock <IMessagingClient> messagingClient,
                                                                CreateUser request,
                                                                UsersCommandService sut)
        {
            // Arrange
            messagingClient.Setup(o => o.PublishMessage(It.IsAny <string>(), request.Tenant)).ReturnsAsync(true);
            // Act
            var response = await sut.Create(request);

            //Assert
            response.Should().NotBe(Guid.Empty, "because id should be returned after successful user creation");
            messagingClient.Verify(o => o.PublishMessage(It.IsAny <string>(), request.Tenant), Times.Once, "because a domain event should be published as part of user creation");
        }
 public UsersController(IDbHelper dbHelper, ISecurityService securityService, UsersCommandService service)
 {
     _dbHelper        = dbHelper;
     _securityService = securityService;
     _service         = service;
 }
 public UsersCommandServiceTest()
 {
     _dbHelperMock        = new Mock <IDbHelper>();
     _securityServiceMock = new Mock <ISecurityService>();
     _service             = new UsersCommandService(_dbHelperMock.Object, _securityServiceMock.Object);
 }