public void IsWorkExperience2MeetsExpectation(string aimRef, int candidate, bool expectation) { var mockDelivery = new Mock <ILearningDelivery>(MockBehavior.Strict); mockDelivery .SetupGet(y => y.LearnAimRef) .Returns(aimRef); var mockItem = new Mock <ILARSLearningCategory>(MockBehavior.Strict); mockItem .SetupGet(y => y.CategoryRef) .Returns(candidate); var categories = new List <ILARSLearningCategory> { mockItem.Object }; var mockLARS = new Mock <ILARSDataService>(MockBehavior.Strict); mockLARS .Setup(x => x.GetCategoriesFor(aimRef)) .Returns(categories); var sut = new DerivedData_29Rule(mockLARS.Object); var result = sut.IsWorkExperience(mockDelivery.Object); Assert.Equal(expectation, result); mockItem.VerifyAll(); }
public void IsWorkExperience2MeetsExpectation(string aimRef, int candidate, bool expectation) { // arrange var mockDelivery = new Mock <ILearningDelivery>(MockBehavior.Strict); mockDelivery .SetupGet(y => y.LearnAimRef) .Returns(aimRef); var mockItem = new Mock <ILARSLearningCategory>(MockBehavior.Strict); mockItem .SetupGet(y => y.CategoryRef) .Returns(candidate); var categories = Collection.Empty <ILARSLearningCategory>(); categories.Add(mockItem.Object); var mockLARS = new Mock <ILARSDataService>(MockBehavior.Strict); mockLARS .Setup(x => x.GetCategoriesFor(aimRef)) .Returns(categories.AsSafeReadOnlyList()); var sut = new DerivedData_29Rule(mockLARS.Object); // act var result = sut.IsWorkExperience(mockDelivery.Object); // assert Assert.Equal(expectation, result); mockItem.VerifyAll(); }