Example #1
0
        public void TestConstructPossibleBridges()
        {
            var parts = Testing.GetTestFileContents("TestInput.txt").Split(Environment.NewLine).ToList();

            var bridgeOptions = Program.ConstructPossibleBridges(parts);
            var options       = new List <List <string> >
            {
                new List <string> {
                    "0/2", "2/3", "3/4"
                },
                new List <string> {
                    "0/2", "2/3", "3/5"
                },
                new List <string> {
                    "0/1", "10/1", "9/10"
                },
                new List <string> {
                    "0/2", "2/2", "2/3", "3/4"
                },
                new List <string> {
                    "0/2", "2/2", "2/3", "3/5"
                },
            };

            Testing.AssertNestedListsEqual(options, bridgeOptions);
        }
Example #2
0
        public void CanParseInputData()
        {
            var data     = Testing.GetTestFileContents("TestInput.txt");
            var actual   = GetFileValues(data);
            var expected = new List <List <int> >
            {
                new List <int> {
                    5, 1, 9, 5
                },
                new List <int> {
                    7, 5, 3
                },
                new List <int> {
                    2, 4, 6, 8
                }
            };

            Testing.AssertNestedListsEqual(expected, actual);
        }
Example #3
0
        public void CanCompareNestedLists()
        {
            try
            {
                Testing.AssertNestedListsEqual(
                    new List <List <int> > {
                    new List <int> {
                        1, 2
                    }, new List <int> {
                        3, 4
                    }
                },
                    new List <List <int> > {
                    new List <int> {
                        1, 2
                    }, new List <int> {
                        3, 4
                    }
                });

                Testing.AssertNestedListsEqual(
                    new List <List <string> > {
                    new List <string> {
                        "a", "b"
                    }, new List <string> {
                        "c", "d"
                    }
                },
                    new List <List <string> > {
                    new List <string> {
                        "a", "b"
                    }, new List <string> {
                        "c", "d"
                    }
                });

                Testing.AssertNestedListsEqual(
                    new List <List <bool> > {
                    new List <bool> {
                        true, false
                    }, new List <bool> {
                        false, true
                    }
                },
                    new List <List <bool> > {
                    new List <bool> {
                        true, false
                    }, new List <bool> {
                        false, true
                    }
                });
            }
            catch (Exception e)
            {
                Assert.Fail($"Expected no exception, but got {e.Message}");
            }

            Assert.ThrowsException <AssertFailedException>(() =>
                                                           Testing.AssertNestedListsEqual(
                                                               new List <List <int> > {
                new List <int> {
                    1, 2
                }, new List <int> {
                    3, 4
                }
            },
                                                               new List <List <int> > {
                new List <int> {
                    1, 2
                }, new List <int> {
                    3, 9
                }
            })
                                                           );
        }