예제 #1
0
        public async Task <Guid> Create(EmployeeCreateRequest request)
        {
            var employee = EmployeeAggregate.CreateFromRequest(request);

            await _repo.Add(employee);

            return(employee.Id);
        }
예제 #2
0
        public void EmployeeAggregate_CreateRandomFromRequest()
        {
            //Arrange
            var request = AggregatesRequestBuilder.CreateRandomEmployeeCreateRequest();

            //Act
            var employee = EmployeeAggregate.CreateFromRequest(request);

            // Assert
            employee.UserId.Should().Be(request.UserId);
            employee.IsDeleted.Should().BeFalse();
        }
예제 #3
0
        public void EmployeeAggregate_ShouldBeDeleted()
        {
            //Arrange
            var request  = AggregatesRequestBuilder.CreateRandomEmployeeCreateRequest();
            var employee = EmployeeAggregate.CreateFromRequest(request);

            //Act
            employee.MarkAsDeleted();

            //Assert
            employee.IsDeleted.Should().BeTrue();
        }