/* * Created by SharpDevelop. * User: silvage * Date: 5/5/2010 * Time: 7:33 PM * * */ using System; using System.Collections.Generic; using NUnit.Framework; using Osce.Classes.Base; using Osce.Classes.Enumerations; namespace UnitTests.Classes.Base { /// /// Unit tests to concrete class Layer /// [TestFixture] public class UT_Layer { protected Layer l; /// /// Specific method used to setup private variable l. /// [SetUp] public void Init() { this.l = new Layer(); } /// /// Specific method to clear the list and reinitialize l variable. /// [TearDown] public void ShutDown() { this.l.GetLayerSourceProperties.Clear(); } /// /// Method to test getters and setters. /// Missing test to ExportFilters /// [Test] [Category("Get/Set")] public void Test_Get_Set_Layer() { this.l.LayerName = "Test"; Assert.AreEqual("Test",this.l.LayerName); Assert.AreEqual(LayerType.Unknown,this.l.GetLayerType); } /// /// Test AddConnectionProperty method /// [Test] [Category("Method Test")] public void Test_AddConnectionProperty() { Assert.AreEqual(0,this.l.GetLayerSourcePropertiesCount); this.l.AddConnectionProperty("TEST","test"); Assert.AreEqual(1,this.l.GetLayerSourcePropertiesCount); } /// /// Test DeleteConnectionProperty Method /// [Test] [Category("Method Test")] public void Test_DeleteConnectionProperty() { Assert.AreEqual(0,this.l.GetLayerSourcePropertiesCount); this.l.AddConnectionProperty("TEST","test"); Assert.AreEqual(1,this.l.GetLayerSourcePropertiesCount); this.l.DeleteConnectionProperty("TEST"); Assert.AreEqual(0,this.l.GetLayerSourcePropertiesCount); } /// /// Test AddConnectionProperty. /// /// /// This test consists in adding the same property twice. This method should /// throw an ArgumentException /// [Test] [Category("Method Test")] [ExpectedException(typeof(ArgumentException))] public void Test_AddConnectionProperty_ThrowException() { this.l.AddConnectionProperty("TEST","test"); Assert.AreEqual(1,this.l.GetLayerSourcePropertiesCount); this.l.AddConnectionProperty("TEST","test"); } /// /// Test DeleteConnectionProperty /// /// /// This test consists in deleting a invalid property. This method should /// throw an ArgumentException /// [Test] [Category("Method Test")] [ExpectedException(typeof(ArgumentException))] public void Test_DeleteConnectionProperty_ThrowException() { this.l.DeleteConnectionProperty("TEST"); } /// /// Test ValidadeConnectionProperties method. /// /// /// This method consists in testing an empty list of requiredConnection properties. /// On this concrete layer the test should always pass. /// [Test] [Category("Method Test")] public void Test_ValidateConnectionProperties() { Assert.AreEqual(true,this.l.ValidateSourceProperties()); } } }