public void Asserts_The_Message(IInjectionMessage message) { var sut = GetSut(); var action = new TestDelegate(() => sut.Alert(message)); Alert_Sut_Alerts_Message(action, message); }
public MemoryInjectionException(IInjectionMessage message) : base(message.ToString()) { InjectionType = message.InjectionType; InjectedObject = message.InjectedObject; DetectionTime = message.InjectionDetectionTime; }
public override void Alert_Sut_Alerts_Message(TestDelegate alertingMessage, IInjectionMessage message) { Assert.That(alertingMessage, Throws.TypeOf <MemoryInjectionException>() .And.With.Property(nameof(MemoryInjectionException.InjectionType)).EqualTo(message.InjectionType) .And.With.Property(nameof(MemoryInjectionException.DetectionTime)).EqualTo(message.InjectionDetectionTime) .And.With.Property(nameof(MemoryInjectionException.InjectedObject)).EqualTo(message.InjectedObject) ); }
public bool Equals(IInjectionMessage other) { if (ReferenceEquals(null, other)) { return(false); } return(this.InjectionType.Equals(other.InjectionType) && (this.InjectedObject?.Equals(other.InjectedObject) ?? false) && this.InjectionDetectionTime.Equals(other.InjectionDetectionTime)); }
public void Alert_ChannelIsDebugWrite_InvokesRaiseEventAlerter(IInjectionMessage info) { //arrange const InjectionAlertChannel channel = InjectionAlertChannel.DebugWrite; var alerterMock = new Mock <IAlerter>(); var sut = GetSut(debugWriteAlerter: alerterMock.Object); //act sut.Alert(info, channel); //assert alerterMock.Verify(a => a.Alert(It.Is <IInjectionMessage>((value) => info.Equals(value)))); }
public void Alert_ChannelIsThrowException_InvokesRaiseEventAlerter(IInjectionMessage info) { // Arrange const InjectionAlertChannel channel = InjectionAlertChannel.ThrowException; var alerterMock = new Mock <IAlerter>(); var sut = GetSut(throwExceptionAlerter: alerterMock.Object); // Act sut.Alert(info, channel); // Assert alerterMock.Verify(a => a.Alert(It.Is <IInjectionMessage>(value => info.Equals(value)))); }
public override void Alert_Sut_Alerts_Message(TestDelegate alertingMessage, IInjectionMessage message) { base.IgnoreTest(); }
/// <exception cref="MemoryInjectionException"> /// <p> /// The state of the object has been changed after last validation. /// <seealso cref="InjectionType.VariableInjection" /> /// </p> /// <p> /// The code of the object has been changed after last validation. /// <seealso cref="InjectionType.CodeInjection" /> /// </p> /// <p> /// Both state and the code code of the object has been changed after last validation. /// <seealso cref="InjectionType.CodeAndVariableInjection" /> /// </p> /// </exception> public void Alert(IInjectionMessage info) { throw new MemoryInjectionException(info); }
public void Alert(IInjectionMessage info) { Debug.Fail(info.ToString()); }
public void Alert(IInjectionMessage info) { Debug.Fail($"An object has been infected by {info.InjectionType} at {info.InjectionDetectionTime.ToLocalTime()}"); }
public void Alert(IInjectionMessage info, InjectionAlertChannel channel) { var alerter = _alerterFactory.Get(channel); alerter.Alert(info); }
public abstract void Alert_Sut_Alerts_Message(TestDelegate alertingMessage, IInjectionMessage message);
public void Alert(IInjectionMessage info) { _safeOrbitCore.AlertInjection(info.InjectedObject, info); }
/// <exception cref="MemoryInjectionException"> /// <p> /// The state of the object has been changed after last validation. /// <seealso cref="InjectionType.VariableInjection" /> /// </p> /// <p> /// The code of the object has been changed after last validation. /// <seealso cref="InjectionType.CodeInjection" /> /// </p> /// <p> /// Both state and the code code of the object has been changed after last validation. /// <seealso cref="InjectionType.CodeAndVariableInjection" /> /// </p> /// </exception> public void Alert(IInjectionMessage info) { throw new MemoryInjectionException(info.InjectionType, info.InjectedObject, info.InjectionDetectionTime); }
public override void Alert_Sut_Alerts_Message(TestDelegate alertingMessage, IInjectionMessage message) { _safeOrbitCoreMock.Invocations.Clear(); alertingMessage.Invoke(); _safeOrbitCoreMock.Verify(core => core.AlertInjection(message.InjectedObject, message)); }
/// <summary> /// Internal method to alert an injection. It's virtual for testability. /// </summary> /// <param name="object">The injected object.</param> /// <param name="info">The information.</param> internal virtual void AlertInjection(object @object, IInjectionMessage info) { var localCopy = LibraryInjected; localCopy?.Invoke(@object, info); }