public void InstanceOK() { //create an instance of our class clsCar clsColour AColour = new clsColour(); //check to see that the class is not null Assert.IsNotNull(AColour); }
public void ColourNamePropertyOK() { //create an instance f the class we want to create clsColour AColour = new clsColour(); //create some test data to assign to the property string SomeColourName = "Red"; //assign the data to the property AColour.ColourName = SomeColourName; //test to see that the two values are the same Assert.AreEqual(AColour.ColourName, SomeColourName); }
public void ColourNoPropertyOK() { //create an instance f the class we want to create clsColour AColour = new clsColour(); //create some test data to assign to the property Int32 TestData = 1; //assign the data to the property AColour.ColourNo = TestData; //test to see that the two values are the same Assert.AreEqual(AColour.ColourNo, TestData); }
public void ColourNameMinBoundary() { //create an instance of the class we want to create clsColour AColour = new clsColour(); //string variable to store any error message String Error = ""; //create some test data to pass to the method string SomeColourName = "aaa"; //this should be ok //invoke the method Error = AColour.Valid(SomeColourName); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void FindMethodOK() { //create an instance of the class we want to create clsColour AColour = new clsColour(); //boolean variable to store the result of the validation Boolean Found = false; //create some test data to assign to the property Int32 ColourNo = 1; //invoke th method Found = AColour.Find(ColourNo); //test to see that the result is correct Assert.IsFalse(Found); }
public void ValidMethodOK() { //create an instance of the class we want to create clsColour AColour = new clsColour(); //string variable to store any error message String Error = ""; //create some test data to assign to the property string SomeColourName = "Red"; //invoke th method Error = AColour.Valid(SomeColourName); //test to see that the result is OK i.e there was no error message returned Assert.AreEqual(Error, ""); }
public void ColourNameExtremeMax() { //create an instance of the class we want to create clsColour AColour = new clsColour(); //string variable to store any error message String Error = ""; //create some test data to pass to the method string SomeColourName = ""; SomeColourName = SomeColourName.PadRight(50, 'a'); //this should fail //invoke the method Error = AColour.Valid(SomeColourName); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void CountMatchesList() { //create an instance of the class we want to create clsColourCollection Colours = new clsColourCollection(); //create some test data to assign to the property //in this case that data needs to be a list of objects List <clsColour> TestList = new List <clsColour>(); //add an item to the list //create the item of test data clsColour TestItem = new clsColour(); //set its properties TestItem.ColourNo = 1; TestItem.ColourName = "Red"; //add the item to the test list TestList.Add(TestItem); //assign the data to the property Colours.AllColours = TestList; //test to see that the two values are the same Assert.AreEqual(Colours.Count, TestList.Count); }