public void NameAccessor() { // Create a new Model and use accessors to set the Model name IModel Model = new Model("TestModel"); // test assertions Assert.IsTrue(Model.ModelName == "TestModel", "Expecting Model.ModelName == 'TestModel'"); }
public void TestDataAccessors() { // Create a new Model and use accessors to set the data IModel Model = new Model("colors"); Model.Data = new List<string>(new[] { "red", "green", "blue" }); List<string> data = (List<string>) Model.Data; // test assertions Assert.IsTrue(data.Count == 3, "Expecting data.Count == 3"); Assert.IsTrue(data[0] == "red", "Expecting data[0] == 'red'"); Assert.IsTrue(data[1] == "green", "Expecting data[1] == 'green'"); Assert.IsTrue(data[2] == "blue", "Expecting data[2] == 'blue'"); }
public void TestConstructor() { // Create a new Model using the Constructor to set the name and data IModel Model = new Model("colors", new List<string>(new[] { "red", "green", "blue" })); List<string> data = (List<string>) Model.Data; // test assertions Assert.IsNotNull(Model, "Expecting Model not null"); Assert.IsTrue(Model.ModelName == "colors", "Expecting Model.ModelName == 'colors'"); Assert.IsTrue(data.Count == 3, "Expecting data.Count == 3"); Assert.IsTrue(data[0] == "red", "Expecting data[0] == 'red'"); Assert.IsTrue(data[1] == "green", "Expecting data[1] == 'green'"); Assert.IsTrue(data[2] == "blue", "Expecting data[2] == 'blue'"); }
public void HasModel() { // register a Model IMainModel mainModel = MainModel.Instance; string name = "aces" + Thread.CurrentThread.Name; IModel Model = new Model(name, new List<string>(new[] { "clubs", "spades", "hearts", "diamonds" })); mainModel.RegisterModel(Model); // assert that the MainModel.hasModel method returns true // for that Model name Assert.IsTrue(mainModel.HasModel(name), "Expecting MainModel.hasModel(name) == true"); // remove the Model mainModel.RemoveModel(name); // assert that the MainModel.hasModel method returns false // for that Model name Assert.IsTrue(mainModel.HasModel(name) == false, "Expecting MainModel.hasModel(name) == false"); }