public void ReturnsNull_WhenGuidCannotBeMatched() { var guid = Guid.NewGuid(); var query = new GetPersonByGuidQuery(guid); var entities = new Mock<IQueryEntities>(MockBehavior.Strict); entities.Setup(p => p.Query<Person>()).Returns(new Person[] { }.AsQueryable); var handler = new GetPersonByGuidHandler(entities.Object); var result = handler.Handle(query); result.ShouldBeNull(); }
public void ThrowsArgumentNullException_WhenQueryArgIsNull() { var handler = new GetPersonByGuidHandler(null); ArgumentNullException exception = null; try { handler.Handle(null); } catch (ArgumentNullException ex) { exception = ex; } exception.ShouldNotBeNull(); // ReSharper disable PossibleNullReferenceException exception.ParamName.ShouldEqual("query"); // ReSharper restore PossibleNullReferenceException }