コード例 #1
0
        public async Task <Employee> Post(EmployeeDto employeeDto)
        {
            var entity = _mapper.Map <Employee>(employeeDto);

            if (!entity.IsValid())
            {
                _notificationContext.AddNotifications(entity.ValidationResult);
                return(entity);
            }

            await _repository.Insert(entity);

            return(entity);
        }
        public void AddNotificationMessage_IsValidTest()
        {
            var notification        = new DomainNotification(_telemetryClient);
            var notificationMessage = new List <NotificationMessage>
            {
                new NotificationMessage("400", "Test Notification")
            };

            notification.AddNotifications(notificationMessage, sendTelemetry: true);

            Assert.True(notification.HasNotifications);
        }