Exemple #1
0
        public void GetGridByDisplayName_OnNotFound_ShouldReturnNull()
        {
            string TestDisplayName = "TestDisplayName";

            XElement TestBlueprint = TestHelpers.DataBuilder.BuildBlueprint()
                                     .AndGridWith()
                                     .DisplayName("arbitraryNameOne")
                                     .ThatsAll()
                                     .AndGridWith()
                                     .DisplayName("arbitraryNameTwo")
                                     .ThatsAll();

            BlueprintDataContext DataContext = new BlueprintDataContext(TestBlueprint);

            // Affirm preconditions
            Assert.That(TestBlueprint.Descendants("DisplayName").Where(e => e.Value == TestDisplayName).Count, Is.Zero,
                        "Test blueprint should not contain the tested DisplayName.");

            var res = DataContext.GetGridByDisplayName(TestDisplayName);

            Assert.That(res, Is.Null);
        }
Exemple #2
0
        public void GetGridByDisplayName_OnMultipleFound_ShouldReturnFirst()
        {
            string TestDisplayName = "TestDisplayName";

            XElement TestBlueprint = TestHelpers.DataBuilder.BuildBlueprint()
                                     .AndGridWith()
                                     .DisplayName(TestDisplayName)
                                     .ExportThis(out XElement ExpectedResultGrid) // Note the declaration/assignment
                                     .ThatsAll()
                                     .AndGridWith()
                                     .DisplayName(TestDisplayName)
                                     .ThatsAll();

            BlueprintDataContext DataContext = new BlueprintDataContext(TestBlueprint);

            // Affirm preconditions
            Assert.That(TestBlueprint.Descendants("DisplayName").Where(e => e.Value == TestDisplayName).Count, Is.GreaterThan(1),
                        "Test blueprint should contain multiple instances of the tested DisplayName.");

            var res = DataContext.GetGridByDisplayName(TestDisplayName);

            Assert.That(res, Is.EqualTo(ExpectedResultGrid));
        }