public void ShouldUpdateWhenInsertingDataWithExistingId()
        {
            // Arrange
            var correlationId = Guid.NewGuid();

            SetupTestDbData(new List <TestDbRow> {
                new TestDbRow {
                    Id = correlationId.ToString(), DataXml = "FakeJsonData"
                }
            });

            IProcessManagerData data = new TestSqlServerData {
                CorrelationId = correlationId, Name = "TestData"
            };
            IProcessManagerFinder processManagerFinder = new SqlServerProcessManagerFinder(_connectionString, string.Empty);

            // Act
            processManagerFinder.InsertData(data);

            // Assert
            var results = GetTestDbData(correlationId);

            Assert.Equal(1, results.Count);
            Assert.Equal(correlationId.ToString(), results[0].Id);
            Assert.NotEqual("FakeJsonData", results[0].DataXml);
            Assert.True(results[0].DataXml.Contains("TestData"));
        }
        public void ShouldInsertData()
        {
            // Arrange
            var correlationId = Guid.NewGuid();
            IProcessManagerData data = new TestSqlServerData { CorrelationId = correlationId, Name = "TestData" };
            IProcessManagerFinder processManagerFinder = new SqlServerProcessManagerFinder(_connectionString, string.Empty);

            // Act
            processManagerFinder.InsertData(data);

            // Assert
            var results = GetTestDbData(correlationId);
            Assert.Equal(1, results.Count);
            Assert.Equal(correlationId.ToString(), results[0].Id);
            Assert.True(results[0].DataXml.Contains("TestData"));
        }
        public void ShouldInsertData()
        {
            // Arrange
            var correlationId        = Guid.NewGuid();
            IProcessManagerData data = new TestSqlServerData {
                CorrelationId = correlationId, Name = "TestData"
            };
            IProcessManagerFinder processManagerFinder = new SqlServerProcessManagerFinder(_connectionString, string.Empty);

            // Act
            processManagerFinder.InsertData(data);

            // Assert
            var results = GetTestDbData(correlationId);

            Assert.Equal(1, results.Count);
            Assert.Equal(correlationId.ToString(), results[0].Id);
            Assert.True(results[0].DataXml.Contains("TestData"));
        }
        public void ShouldUpdateWhenInsertingDataWithExistingId()
        {
            // Arrange
            var correlationId = Guid.NewGuid();
            SetupTestDbData(new List<TestDbRow> { new TestDbRow { Id = correlationId.ToString(), DataXml = "FakeJsonData" } });

            IProcessManagerData data = new TestSqlServerData { CorrelationId = correlationId, Name = "TestData" };
            IProcessManagerFinder processManagerFinder = new SqlServerProcessManagerFinder(_connectionString, string.Empty);

            // Act
            processManagerFinder.InsertData(data);

            // Assert
            var results = GetTestDbData(correlationId);
            Assert.Equal(1, results.Count);
            Assert.Equal(correlationId.ToString(), results[0].Id);
            Assert.NotEqual("FakeJsonData", results[0].DataXml);
            Assert.True(results[0].DataXml.Contains("TestData"));
        }