Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InSequence for protected mocks #1174

Closed

Conversation

tonyhallett
Copy link
Contributor

@tonyhallett tonyhallett commented Jun 22, 2021

Will resolve #1173 when implementations are provided for two Setup methods as described below.

For discussion

There is common code with existing WhenPhrase and Mock methods that differ only in the condition - for instance

//When

		public ISetup<T> Setup(Expression<Action<T>> expression)
		{
			var setup = Mock.Setup(mock, expression, this.condition);
			return new VoidSetupPhrase<T>(setup);
		}
//Mock<T>

		public ISetup<T, TResult> Setup<TResult>(Expression<Func<T, TResult>> expression)
		{
			var setup = Mock.Setup(this, expression, null);
			return new NonVoidSetupPhrase<T, TResult>(setup);
		}

The code in this pull request follows suit. WhenPhraseProtected differs to ProtectedAsMock only by condition.


Note that WhenPhraseProtected throws NotImplementedException for SetupSet methods
These can be added to match #1165

@stakx
Copy link
Contributor

stakx commented Jan 3, 2023

@tonyhallett, same here as in your other PR, and as mentioned in the issue belonging to this PR: this isn't the right time to review code changes as long as no decision has been reached about the future direction for sequences. I'm not convinced at this time that the current .InSequence / MockSequence mechanism is the right way forward.

@stakx stakx closed this Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

InSequence is not available for protected
2 participants