public void ShouldWriteToFile(List <string> inputFile, NodeState newState, List <string> expectedLines)
        {
            string tmpFilePAth = Path.GetTempFileName();

            File.WriteAllLines(tmpFilePAth, inputFile);

            ConfigurationFileHandler cfh = new ConfigurationFileHandler(tmpFilePAth);

            cfh.WriteNewState(newState);

            List <string> resultingLines = File.ReadAllLines(tmpFilePAth).ToList();

            resultingLines.Should().ContainInOrder(expectedLines);
        }
        public void ShouldThrowIfFileDissapears()
        {
            string tmpFilePAth = Path.GetTempFileName();

            File.WriteAllLines(tmpFilePAth, new List <string>
            {
                "#This is a config file",
                "IS_SIGNING=non-signing",
                "PARITY_VERSION=parity/parity:v2.4.0",
                "PARITY_CHKSUM=30b9c9852b52546e7de32832ddfaa4aba33c0c436c985ad97d3fe9c4210043d8",
                "ANOTHER_KEY=foobar",
                "KEY_2=awesomesource",
                "SESSION_MANAGER=local/yoga-markus:@/tmp/.ICE-unix/2876,unix/yoga-markus:/tmp/.ICE-unix/2876",
                "SHELL=/usr/bin/zsh",
                "This is a comment right in the middle",
                "SHLVL=2",
                "SSH_AGENT_PID=2940",
                "SSH_AUTH_SOCK=/run/user/1000/keyring/ssh",
                "TERM=screen",
                "CHAINSPEC_URL=https://example.com/chainspec-20190303.json",
                "CHAINSPEC_CHKSUM=7e40a9d4a3066f839882e0fc26acd9e2f08bdbd314b7319db7cae54cd4450ee9"
            });

            // instantiate with existing file to pass first file check
            ConfigurationFileHandler cfh = new ConfigurationFileHandler(tmpFilePAth);

            // remove file
            File.Delete(tmpFilePAth);

            // make sure it was removed
            if (File.Exists(tmpFilePAth))
            {
                throw new TestFailureException("Test file didn't get removed. Results would be wrong.");
            }

            // Should fail on a file write attempt
            Assert.Throws <FileNotFoundException>(() => { cfh.WriteNewState(new NodeState()); });

            // Should fail on a file read attempt
            Assert.Throws <FileNotFoundException>(() => { _ = cfh.ReadCurrentState(); });
        }