コード例 #1
0
        public void CompareDataSets_WhenDatasetsHaveDifferentTableNames_ThenFail()
        {
            var expectedDataset = new Dataset {
                Name  = "all-my-table-records-a",
                Table = "MyTable"
            };

            var actualDataset = new Dataset {
                Name  = "all-my-table-records-b",
                Table = "AnotherTable"
            };

            Action action = () => DatabaseManagerHelper.CompareDatasets(expectedDataset, actualDataset, new string[] { "key" }, false, true);

            action.Should().Throw <XunitException>().WithMessage("*because table names should be the same*");
        }
コード例 #2
0
        public void CompareDatasets_WhenBothDatasetsAreEmpty_ThenSucceed()
        {
            var expectedDataset = new Dataset {
                Name  = "all-my-table-records-a",
                Table = "MyTable",
                Rows  = new()
            };

            var actualDataset = new Dataset {
                Name  = "all-my-table-records-b",
                Table = "MyTable",
                Rows  = new()
            };

            Action action = () => DatabaseManagerHelper.CompareDatasets(expectedDataset, actualDataset, new string[] { "key" }, false, true);

            action.Should().NotThrow();
        }
コード例 #3
0
        public void CompareDatasets_WhenExpectedIsNotEmptyAndActualIs_ThenFail()
        {
            var expectedDataset = new Dataset {
                Name  = "all-my-table-records-a",
                Table = "MyTable",
                Rows  = new() {
                    new Row {
                        Columns = new() {
                            new("Id", "1")
                        }
                    }
                }
            };

            var actualDataset = new Dataset {
                Name  = "all-my-table-records-b",
                Table = "MyTable",
                Rows  = new()
            };

            Action action = () => DatabaseManagerHelper.CompareDatasets(expectedDataset, actualDataset, new string[] { "key" }, false, true);

            action.Should().Throw <XunitException>().WithMessage("*because expected data is not empty*");
        }