Exemplo n.º 1
0
        public void CheckIfXmlClassIsCreatingFileInDefaultPath()
        {
            // Arrange
            _file = TestsExtensions.GetFileFromDefaultPath();

            // Act
            _xml = new Xml(TestFileName);

            // Assert
            Assert.That(_xml.Exists, Is.True);
            FileCreationAssertTests(_file, _xml);
        }
Exemplo n.º 2
0
        public void ReadFileToEndWhenFileExists()
        {
            // Arrange
            _file = TestsExtensions.GetFileFromDefaultPath();
            TestsExtensions.WriteSampleDataToTestFile(_file);
            var resultFromTestExt = TestsExtensions.ReadFileForTest(_file);

            // Act
            var result = FileDirectory.ReadFileToEnd(_file.FullName);

            // Assert
            Assert.That(result, Is.EqualTo(resultFromTestExt));
        }
Exemplo n.º 3
0
        public void CheckCreationOfEmptyFileWhenPathExists()
        {
            // Arrange
            _file = TestsExtensions.GetFileFromDefaultPath();

            // Act
            var result = FileDirectory.CreateEmptyFile(_file.FullName);

            // Assert
            Assert.That(_file.Exists, Is.True);
            Assert.That(_file.Length, Is.EqualTo(0));
            Assert.That(result, Is.True);
        }
Exemplo n.º 4
0
        public void ReadFileToEndWhenFileIsEmpty()
        {
            // Arrange
            var emptyFile = TestsExtensions.GetFileFromDefaultPath().FullName;

            TestsExtensions.CreateEmptyFile(emptyFile);

            // Act
            var result = FileDirectory.ReadFileToEnd(emptyFile);

            // Assert
            Assert.That(result, Is.EqualTo(""));
        }
Exemplo n.º 5
0
        public void DoesSettingsTestClassPropertiesHasGotDefaultValues()
        {
            var attrForStringName = TestsExtensions.GetAttributesFromProperties(typeof(SettingsTestClass), "StringName")[0]
                                    as SettingsDefaultValueAttribute;
            var attrForIntName = TestsExtensions.GetAttributesFromProperties(typeof(SettingsTestClass), "IntName")[0]
                                 as SettingsDefaultValueAttribute;

            Assert.That(attrForStringName, Is.TypeOf(typeof(SettingsDefaultValueAttribute)));
            Assert.That(attrForIntName, Is.TypeOf(typeof(SettingsDefaultValueAttribute)));

            Assert.That(attrForStringName.Value, Is.EqualTo("test_string"));
            Assert.That(attrForIntName.Value, Is.EqualTo(100));
        }
Exemplo n.º 6
0
        public void CheckIfXmlClassIsCreatingBaseStructure()
        {
            _xml = new Xml(TestFileName);
            _xml.CreateBaseStructure();

            var file = TestsExtensions.GetFileFromDefaultPath();

            Assert.That(_xml.Exists, Is.True);
            Assert.That(file.Length, Is.GreaterThan(0));



            file.Delete();
        }