public void CreateError_ShortMessage_ErrorCreated()
        {
            var clientErrorDto = new ClientErrorDto
            {
                Message       = "Hello World",
                ClientVersion = "0.99",
                LineNumber    = 2
            };

            ClientErrorDto createdErrorDto = ClientErrorController.Create(clientErrorDto);

            Assert.NotNull(createdErrorDto);
        }
        public void CreateError_LongMessage_MessageTruncatedErrorCreated()
        {
            var clientErrorDto = new ClientErrorDto
            {
                Message =
                    "Hello World This is a Really Long Message Which is going to be over 2000 characters in length when finished which will cause the end result message to be truncated with three periods as to not overflow the database. Can I confirm that this is happening? Thanks xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
                ClientVersion = "0.99",
                LineNumber    = 2
            };

            ClientErrorDto createdErrorDto = ClientErrorController.Create(clientErrorDto);

            Assert.NotNull(createdErrorDto);
            Assert.That(createdErrorDto.Message.Length == ClientError.MaxMessageLength);
        }
        public ClientErrorDto Create(ClientErrorDto clientErrorDto)
        {
            ClientErrorDto savedErrorDto;

            using (ITransaction transaction = Session.BeginTransaction())
            {
                ClientError clientError = new ClientError(clientErrorDto.InstanceId, clientErrorDto.Architecture, clientErrorDto.ClientVersion, clientErrorDto.LineNumber, clientErrorDto.BrowserVersion, clientErrorDto.Message, clientErrorDto.OperatingSystem, clientErrorDto.Url, clientErrorDto.Stack, clientErrorDto.UserId);
                ClientClientErrorManager.Save(clientError);

                savedErrorDto = ClientErrorDto.Create(clientError);

                transaction.Commit();
            }

            return(savedErrorDto);
        }