public override bool Equals(object obj) { if (obj == null) { return(false); } TestSerializerModel3 model = obj as TestSerializerModel3; if (model == null) { return(false); } if (this.StringVal != model.StringVal) { return(false); } if (this.Category.CategoryID != model.Category.CategoryID || this.Category.CategoryName != model.Category.CategoryName) { return(false); } if (this.Customer.Address != model.Customer.Address || this.Customer.ContactName != model.Customer.ContactName || this.Customer.CustomerID != model.Customer.CustomerID || this.Customer.CustomerName != model.Customer.CustomerName || this.Customer.PostalCode != model.Customer.PostalCode || this.Customer.Tel != model.Customer.Tel) { return(false); } if (this.Product.CategoryID != model.Product.CategoryID || this.Product.ProductID != model.Product.ProductID || this.Product.ProductName != model.Product.ProductName || this.Product.Quantity != model.Product.Quantity || this.Product.Remark != model.Product.Remark || this.Product.Unit != model.Product.Unit || this.Product.UnitPrice.ToString("F4") != model.Product.UnitPrice.ToString("F4")) { return(false); } return(true); }
public int Test6(Category category, Product product, Customer customer, string stringVal) { TestSerializerModel3 model = new TestSerializerModel3 { StringVal = stringVal, Category = category, Customer = customer, Product = product }; if( model.Equals(s_lastTestSerializerModel3) ) return 1; else return 0; }
public int Test5(TestSerializerModel3 model) { if( model.Equals(s_lastTestSerializerModel3) ) return 1; else return 0; }
private TestSerializerModel3 GetTestSerializerModel3() { Random rand = new Random(); TestSerializerModel3 model = new TestSerializerModel3 { StringVal = "Fish Li" }; int index = rand.Next(1, WebSiteDB.MyNorthwind.Categories.Count - 1); model.Category = WebSiteDB.MyNorthwind.Categories.Skip(index).Take(1).First(); index = rand.Next(1, WebSiteDB.MyNorthwind.Products.Count - 1); model.Product = WebSiteDB.MyNorthwind.Products.Skip(index).Take(1).First(); index = rand.Next(1, WebSiteDB.MyNorthwind.Customers.Count - 1); model.Customer = WebSiteDB.MyNorthwind.Customers.Skip(index).Take(1).First(); s_lastTestSerializerModel3 = model; return model; }