Example #1
0
        public void xml_file_will_be_created_if_none_exists()
        {
            var logger = new UserXMLLogger();

            var user = new User
            {
                UserName = "******",
                Email = "*****@*****.**"
            };

            logger.Log(user);

            Assert.That(File.Exists("user_log.xml"));
        }
Example #2
0
        public void logging_a_user_will_save_it_to_file()
        {
            var logger = new UserXMLLogger();

            var user = new User
            {
                UserName = "******",
                Email = "*****@*****.**"
            };

            logger.Log(user);

            Assert.That(File.Exists("user_log.xml"));
            var doc = new XmlDocument();
            doc.Load("user_log.xml");
            XmlNode node = doc.DocumentElement.FirstChild;
            Assert.That(node.Attributes["name"].Value, Is.EqualTo("Jim"));
            Assert.That(node.Attributes["email"].Value, Is.EqualTo("*****@*****.**"));
        }