Ejemplo n.º 1
0
        public void LoadFromFile_Test_ThrowsException()
        {
            // arrange
            var xmlfileLoadSave = new XMLFileLoadSave();

            // act
            var result = xmlfileLoadSave.LoadFromFile("fileName");
        }
Ejemplo n.º 2
0
        public void SaveToFile_Test_ReturnsTrue()
        {
            // arrange
            var xmlfileLoadSave = new XMLFileLoadSave();
            var expenseItem     = new ExpenseItem();
            var items           = new List <ExpenseItem> {
                expenseItem
            };

            Isolate.WhenCalled(() => File.WriteAllLines(null, (IEnumerable <string>)null)).IgnoreCall();

            // act
            var result = xmlfileLoadSave.SaveToFile("fileName", items);

            // assert
            Assert.AreEqual(true, result);
        }
Ejemplo n.º 3
0
        public void LoadFromFile_Test_ThrowsConfigurationErrorsException()
        {
            // arrange
            var xmlfileLoadSave = new XMLFileLoadSave();

            Isolate.WhenCalled(() => File.Exists(null)).WillReturn(true);
            var handleXmlTextReader = Isolate.Fake.AllInstances <XmlTextReader>(Members.CallOriginal);

            Isolate.WhenCalled(() => handleXmlTextReader.NodeType).WillReturn(XmlNodeType.EndElement);
            Isolate.WhenCalled(() => handleXmlTextReader.Name).WillReturn("Name");
            var handleXmlUrlResolver = Isolate.Fake.AllInstances <XmlUrlResolver>(Members.CallOriginal);
            var uri = new Uri("http://www.example.com/page.html?query=1324&nbsp;o=qwer");

            Isolate.WhenCalled(() => handleXmlUrlResolver.ResolveUri(null, null)).WillReturn(uri);

            // act
            var result = xmlfileLoadSave.LoadFromFile("fileName");
        }