public Result Verify(ILicensedProduct licensedProduct) { if (licensedProduct == null) { throw new ArgumentNullException(nameof(licensedProduct)); } if (!Signed) { throw new InvalidOperationException("This license already is not signed."); } if (ExpirationTime.Expired) { return(Result.Fail("This license is expired.")); } if (!ProductName.Equals(licensedProduct.ProductName, StringComparison.Ordinal)) { return(Result.Fail("This license is not for this product.")); } if (!ProductVersion.Equals(licensedProduct.ProductVersion, StringComparison.Ordinal)) { return(Result.Fail("This license is not for this product.")); } if (!UniqueId.Equals(licensedProduct.UniqueId, StringComparison.Ordinal)) { return(Result.Fail("This license is not for this machine.")); } return(Result.Ok()); }
//----------------------------------------------------------------------------------------- /// <summary> /// Execute the order process /// </summary> public override void OrderExecution() { if (ProductName.Equals("Learning to Ski,")) { Console.WriteLine("First Aid"); } }
public override bool Equals(object obj) { if ((obj == null) || !this.GetType().Equals(obj.GetType())) { return(false); } Product other = (Product)obj; return(ProductId == other.ProductId && ProductName.Equals(other.ProductName)); // or anything else you want to compare }
public void EqualityTest() { var hoge = new ProductName("Hoge"); var huga = new ProductName("Huga"); Assert.IsFalse(hoge.Equals(huga)); var hoge1 = new ProductName("Hoge"); var hoge2 = new ProductName("Hoge"); Assert.IsTrue(hoge1.Equals(hoge2)); }
public bool Equals(TempSaleDTO other) { return(other != null ? CustomerName.Equals(other.CustomerName) && ManagerName.Equals(other.ManagerName) && ProductName.Equals(other.ProductName) && SaleDate.Equals(other.SaleDate) && SessionId.Equals(other.SessionId) && Total.Equals(other.Total) && Id.Equals(other.Id) : false); }
public override bool Equals(object obj) { if (obj is Product) { Product other = (Product)obj; return(ProductID == other.ProductID && ProductName.Equals(other.ProductName) && Category.Equals(other.Category) && UnitPrice == other.UnitPrice && UnitsInStock == other.UnitsInStock); } else { return(false); } }
public override bool Equals(Object obj) { Identifier other = obj as Identifier; if (other == null) { return(false); } else { return(ProductName.Equals(other.ProductName) && Number.Equals(other.Number)); } }
public override bool Equals(object obj) { try { var comparingObject = (CartItem)obj; return(Id == comparingObject.Id && ProductName.Equals(comparingObject.ProductName) && Description.Equals(comparingObject.Description) && Quantity == comparingObject.Quantity && CostPerUnit == comparingObject.CostPerUnit); } catch (InvalidCastException e) { throw e; } }
public bool Equals(Product other) { if (ReferenceEquals(other, null)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } //Check whether the products' properties are equal. return(CategoryIdentifier.Equals(other.CategoryIdentifier) && ProductName.Equals(other.ProductName)); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (!(obj is Product)) { return(false); } Product product = obj as Product; return(ProductName.Equals(product.ProductName) && UnitPrice == product.UnitPrice && SupplierId == product.SupplierId && CategoryId == product.CategoryId); }
public int CompareTo(object obj) { if (obj is null || this is null) { return(0); } var cat = obj as Category; if (ProductName != null && cat.ProductName != null && !ProductName.Equals(cat.ProductName)) { return(ProductName.CompareTo(cat.ProductName)); } if (!Type.Equals(cat.Type)) { return(Type.CompareTo(cat.Type)); } else { return(Topic.CompareTo(cat.Topic)); } }
/// <summary> /// Returns true if OrderLineDetails instances are equal /// </summary> /// <param name="other">Instance of OrderLineDetails to be compared</param> /// <returns>Boolean</returns> public bool Equals(OrderLineDetails other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( DiscountAmount == other.DiscountAmount || DiscountAmount != null && DiscountAmount.Equals(other.DiscountAmount) ) && ( GoogleProductCategoryId == other.GoogleProductCategoryId || GoogleProductCategoryId != null && GoogleProductCategoryId.Equals(other.GoogleProductCategoryId) ) && ( LineAmountTotal == other.LineAmountTotal || LineAmountTotal != null && LineAmountTotal.Equals(other.LineAmountTotal) ) && ( ProductCategory == other.ProductCategory || ProductCategory != null && ProductCategory.Equals(other.ProductCategory) ) && ( ProductCode == other.ProductCode || ProductCode != null && ProductCode.Equals(other.ProductCode) ) && ( ProductName == other.ProductName || ProductName != null && ProductName.Equals(other.ProductName) ) && ( ProductPrice == other.ProductPrice || ProductPrice != null && ProductPrice.Equals(other.ProductPrice) ) && ( ProductType == other.ProductType || ProductType != null && ProductType.Equals(other.ProductType) ) && ( Quantity == other.Quantity || Quantity != null && Quantity.Equals(other.Quantity) ) && ( TaxAmount == other.TaxAmount || TaxAmount != null && TaxAmount.Equals(other.TaxAmount) ) && ( Unit == other.Unit || Unit != null && Unit.Equals(other.Unit) )); }
public bool Equals(Product prod) { return(ProductCategory.Equals(prod.ProductCategory) && ProductGroup.Equals(prod.ProductGroup) && ProductName.Equals(prod.ProductName)); }
public override bool Equals(object obj) { Product other = (Product)obj; return(ProductId == other.ProductId && ProductName.Equals(other.ProductName)); // or anything else you want to compare }