public void Equality_Default() { var a = new EventSubscriptionStatement(); var b = new EventSubscriptionStatement(); Assert.AreEqual(a, b); Assert.AreEqual(a.GetHashCode(), b.GetHashCode()); }
public void DefaultValues() { var sut = new EventSubscriptionStatement(); Assert.AreEqual(new UnknownReference(), sut.Reference); Assert.AreEqual(EventSubscriptionOperation.Add, sut.Operation); Assert.AreEqual(new UnknownExpression(), sut.Expression); Assert.AreNotEqual(0, sut.GetHashCode()); Assert.AreNotEqual(1, sut.GetHashCode()); }
public void Equality_DifferentOperation() { var a = new EventSubscriptionStatement { Operation = EventSubscriptionOperation.Remove }; var b = new EventSubscriptionStatement(); Assert.AreNotEqual(a, b); Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode()); }
public void Equality_DifferentReference() { var a = new EventSubscriptionStatement { Reference = new VariableReference {Identifier = "x"} }; var b = new EventSubscriptionStatement(); Assert.AreNotEqual(a, b); Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode()); }
public void Equality_DifferentExpression() { var a = new EventSubscriptionStatement { Expression = new ConstantValueExpression() }; var b = new EventSubscriptionStatement(); Assert.AreNotEqual(a, b); Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode()); }
public void SettingValues() { var sut = new EventSubscriptionStatement { Reference = new VariableReference {Identifier = "x"}, Operation = EventSubscriptionOperation.Remove, Expression = new ConstantValueExpression() }; Assert.AreEqual(new VariableReference {Identifier = "x"}, sut.Reference); Assert.AreEqual(EventSubscriptionOperation.Remove, sut.Operation); Assert.AreEqual(new ConstantValueExpression(), sut.Expression); }
public void Equality_ReallyTheSame() { var a = new EventSubscriptionStatement { Reference = new VariableReference {Identifier = "x"}, Operation = EventSubscriptionOperation.Remove, Expression = new ConstantValueExpression() }; var b = new EventSubscriptionStatement { Reference = new VariableReference {Identifier = "x"}, Operation = EventSubscriptionOperation.Remove, Expression = new ConstantValueExpression() }; Assert.AreEqual(a, b); Assert.AreEqual(a.GetHashCode(), b.GetHashCode()); }
public void EventSubscriptionStatement_Unsubscribe() { var sst = new EventSubscriptionStatement { Reference = new EventReference { EventName = Names.Event("[EventType,P] [DeclaringType,P].SomeEvent"), Reference = SSTUtil.VariableReference("o") }, Expression = new ReferenceExpression { Reference = new MethodReference { MethodName = Names.Method("[ReturnType,P] [DeclaringType,P].Handler()"), Reference = SSTUtil.VariableReference("this") } }, Operation = EventSubscriptionOperation.Remove }; AssertPrint(sst, "o.SomeEvent -= this.Handler;"); }
public void VisitorWithReturnIsImplemented() { var sut = new EventSubscriptionStatement(); sut.Accept(23).VerifyWithReturn(v => v.Visit(sut, 23)); }