Ejemplo n.º 1
0
        public void Should_Be_Able_To_Write_String_To_TextFile()
        {
            DataProviderSettings settings = new DataProviderSettings();

            settings.Location  = "C:\\Dev\\DevApps\\StatSnapShotter\\StatSnapShotter\\storage.txt";
            textFileConnection = new TextFileConnection(settings);

            var expected = true;
            var actual   = textFileConnection.Write("this is my text");

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        public void Should_Not_Be_Able_To_Write_Int_To_TextFile()
        {
            DataProviderSettings settings = new DataProviderSettings();

            settings.Location  = "C:\\Dev\\DevApps\\StatSnapShotter\\StatSnapShotter\\storage.txt";
            textFileConnection = new TextFileConnection(settings);

            var expected = false;
            var actual   = textFileConnection.Write(123213);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 3
0
        public void Can_Read_TextFile()
        {
            DataProviderSettings settings = new DataProviderSettings();

            settings.Location  = "C:\\Dev\\DevApps\\StatSnapShotter\\StatSnapShotter\\storage.txt";
            textFileConnection = new TextFileConnection(settings);

            textFileConnection.Write("this is my text", true);

            var expected = "this is my text";
            var actual   = textFileConnection.Read(null);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 4
0
        public void Can_String_Be_Written_To_TextFile_If_File_Does_Not_Exist()
        {
            DataProviderSettings settings = new DataProviderSettings();

            settings.Location  = Guid.NewGuid().ToString() + ".txt";
            textFileConnection = new TextFileConnection(settings);

            var expected = "this is my text";

            textFileConnection.Write("this is my text", true);
            var actual = textFileConnection.Read(null);

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 5
0
        public void Can_String_Be_Written_To_TextFile_If_File_Invalid()
        {
            DataProviderSettings settings = new DataProviderSettings();

            settings.Location  = "C:\\Dev\\DevApps\\StatSnapShotter\\StatSnapShotter\\" + DateTime.Now.ToString() + ".txt";
            textFileConnection = new TextFileConnection(settings);

            string expected = null;

            textFileConnection.Write("this is my text", true);
            var actual = textFileConnection.Read(null);

            Assert.AreEqual(expected, actual);
        }