using System.Collections;
using System.Collections.Generic;
public void CreateObjectType_Check_EachAttribute_foran_ObjectType()
ObjectTypes types = new ObjectTypes();
types.AttrName = "Model No";
types.AttrType = "String";
types.AttrOptional = "No";
var attributeList = new Dictionary<string, ObjectTypes>();
attributeList.Add(types.AttrName, types);
ObjectTypes types1 = new ObjectTypes();
types1.AttrName = "Sl No";
types1.AttrType = "String";
types1.AttrOptional = "No";
var attributeList1 = new Dictionary<string, ObjectTypes>();
attributeList1.Add(types1.AttrName, types1);
List<Dictionary<string, ObjectTypes>> lstattributes = new List<Dictionary<string, ObjectTypes>>();
lstattributes.Add(attributeList);
lstattributes.Add(attributeList1);
var ObjTypeattributeList = new Dictionary<string, List<Dictionary<string, ObjectTypes>>>();
ObjTypeattributeList.Add("Laptop", lstattributes);
ObjectTypes types3 = new ObjectTypes();
types3.AttrName = "Model No";
types3.AttrType = "String";
types3.AttrOptional = "No";
var attributeList3 = new Dictionary<string, ObjectTypes>();
attributeList3.Add(types3.AttrName, types3);
var ObjTypeattributeList1 = new Dictionary<string, Dictionary<string, ObjectTypes>>();
ObjTypeattributeList1.Add("Fridge", attributeList3);
ObjectTypeController objtype_Controller = new ObjectTypeController();
objtype_Controller.Save(ObjTypeattributeList);
Assert.AreEqual(lstattributes, objtype_Controller.GetAttributeList("Laptop") );
private List<string> invalidStrings = new List<string>
public void check_for_empty_attribute_name()
Dictionary<string, List<string>> dictObjAttributes= new Dictionary<string, List<string>>();
List<String> lstAttributes = new List<String> ();
lstAttributes.Add("String");
lstAttributes.Add("100");
dictObjAttributes["Laptop"]= lstAttributes;
foreach (String item in lstAttributes)
Assert.IsTrue(lstAttributes.Contains("invalid"), item);
public String AttrName { get; set; }
public String AttrType { get; set; }
public String AttrSize { get; set; }
public String AttrOptional { get; set; }
public class ObjectTypeName
public String TypeName { get; set; }
public class ObjectTypeController
List<Dictionary<string, List<Dictionary<string, ObjectTypes>>>> lstobjtypes = new List<Dictionary<string, List<Dictionary<string, ObjectTypes>>>>();
Dictionary<string, Dictionary<string, ObjectTypes>> _objType = new Dictionary<string, Dictionary<string, ObjectTypes>>();
public void Save(Dictionary<string, List<Dictionary<string, ObjectTypes>>> lst)
string json = JsonConvert.SerializeObject(lst, Formatting.Indented);
Console.WriteLine(lstobjtypes.Count());
public List<Dictionary<string, ObjectTypes>> GetAttributeList(string objecttypename, int attributeindex = 0)
List<string> retvalue = new List<string>();
List<ObjectTypes> retvalue1 = new List<ObjectTypes>();
List<Dictionary<string, ObjectTypes>> dictObjAttributes= new List<Dictionary<string, ObjectTypes>>();
List<Dictionary<string, List<string>>> lstattr = new List<Dictionary<string, List<string>>>();
foreach (Dictionary<string, List<Dictionary<string, ObjectTypes>>> dic in lstobjtypes) {
Console.WriteLine("aaaa" + objecttypename);
Console.WriteLine(pair.Key);
if (dic.ContainsKey(objecttypename))
Console.WriteLine("Hi" + dictObjAttributes.Count);
dictObjAttributes = dic[objecttypename];
return dictObjAttributes;
public static void Main()
var x = new NUnitLite.AutoRun().Execute(new string[]{"--test:TestProject", "--noc"});
Console.WriteLine("----------------------------------------------");
Console.WriteLine(x==0?"All Test Passed... :¬)": string.Format("{0} tests failed... :¬(", x));
Console.WriteLine("----------------------------------------------");