コード例 #1
0
        public void InIt()
        {
            _mockData = new List <string>()
            {
                "nop +0",
                "acc +1",
                "jmp +4",
                "acc +3",
                "jmp -3",
                "acc -99",
                "acc +1",
                "jmp -4",
                "acc +6"
            };
            var autoMocker = new AutoMoqer();

            _fileReaderMock = autoMocker.GetMock <IFileReader>();
            _fileReaderMock.Setup(f => f.ReadFileToStringArray(It.IsAny <string>())).Returns(_mockData);

            _solution = new Day8Solution(_fileReaderMock.Object);
        }
コード例 #2
0
        public void Parse()
        {
            var subject = new Day8Solution();

            Day8Solution.Node result = subject.Parse("2 3 0 3 10 11 12 1 1 0 1 99 2 1 1 2");

            result.Should().BeEquivalentTo(new Day8Solution.Node
            {
                Children = new List <Day8Solution.Node>
                {
                    new Day8Solution.Node()
                    {
                        Metadata = new List <int> {
                            10, 11, 12
                        }
                    },
                    new Day8Solution.Node
                    {
                        Children = new List <Day8Solution.Node>
                        {
                            new Day8Solution.Node()
                            {
                                Metadata = new List <int> {
                                    99
                                }
                            }
                        },
                        Metadata = new List <int> {
                            2
                        }
                    }
                },
                Metadata = new List <int> {
                    1, 1, 2
                }
            });
        }