public void SessionStateServiceGetByIdReturnsnullWhenNotFound() { // arrange SessionStateModel <TestSessionStateModel>?expectedResult = default; var documentService = A.Fake <IDocumentService <SessionStateModel <TestSessionStateModel> > >(); A.CallTo(() => documentService.GetByIdAsync(A <Guid> .Ignored, A <string> .Ignored)).Returns(expectedResult); var sessionStateService = new SessionStateService <TestSessionStateModel>(documentService); // act var result = sessionStateService.GetAsync(Guid.NewGuid()).Result; // assert A.CallTo(() => documentService.GetByIdAsync(A <Guid> .Ignored, A <string> .Ignored)).MustHaveHappenedOnceExactly(); A.Equals(result, expectedResult); }