public void LetterTemplateLogicParameterlessConstructorTest1() { var target = new LetterTemplateLogic(Constants.ConnectionString); //Assert Assert.IsInstanceOfType(target, typeof(LetterTemplateLogic)); }
public void LetterTemplateLogicConstructorTest2() { Mock <ILetterTemplateRepository> mockLetterTemplateLogic = new Mock <ILetterTemplateRepository>(); LetterTemplateLogic target = new LetterTemplateLogic(mockLetterTemplateLogic.Object); Assert.IsInstanceOfType(target, typeof(LetterTemplateLogic)); }
/// <summary> /// Initializes a new instance of the <see cref="LetterTemplateController"/> class. /// </summary> public LetterTemplateController() { int facilityId = Convert.ToInt32(System.Web.HttpContext.Current.Request.Headers[Constants.BubbleDataSource]); string bubbleDataSource = GetFacilityConnection(facilityId); _letterTemplateLogic = new LetterTemplateLogic(bubbleDataSource); }
public void GetAllLetterTemplatesTest() { //Arrange var mockLetterTemplateRepository = new Mock <ILetterTemplateRepository>(); LetterTemplateContainer result = new LetterTemplateContainer { LetterTemplates = new List <LetterTemplate> { new LetterTemplate { LetterTemplateId = 1, Name = "Test1", TemplateText = "Letter Text 1" }, new LetterTemplate { LetterTemplateId = 2, Name = "Test2", TemplateText = "Letter Text 2" } }, TotalRecords = 200, PageSetting = new PageSetting() }; mockLetterTemplateRepository.Setup(f => f.GetLetterTemplates(It.IsAny <LetterTemplateContainer>())) .Returns(result); LetterTemplateLogic target = new LetterTemplateLogic(mockLetterTemplateRepository.Object); //Act LetterTemplateContainer actual = target.GetLetterTemplates(null); //Assert Assert.AreEqual(result, actual); }
public void IsLetterNameExists() { var mockLetterTemplateLogic = new Mock <ILetterTemplateRepository>(); mockLetterTemplateLogic.Setup(f => f.IsLetterNameExists(It.IsAny <LetterTemplate>())).Returns(true); LetterTemplateLogic target = new LetterTemplateLogic(mockLetterTemplateLogic.Object); bool actual = target.IsLetterNameExists(new LetterTemplate()); Assert.AreEqual(true, actual); }
public void GetLetterTemplates() { var mockLetterTemplateLogic = new Mock <ILetterTemplateRepository>(); LetterTemplateContainer result = new LetterTemplateContainer(); mockLetterTemplateLogic.Setup(f => f.GetLetterTemplates(It.IsAny <LetterTemplateContainer>())) .Returns(result); LetterTemplateLogic target = new LetterTemplateLogic(mockLetterTemplateLogic.Object); LetterTemplateContainer actual = target.GetLetterTemplates(new LetterTemplateContainer()); Assert.AreEqual(result, actual); }
public void Save() { var mockLetterTemplateLogic = new Mock <ILetterTemplateRepository>(); const long result = 12; mockLetterTemplateLogic.Setup(f => f.Save(It.IsAny <LetterTemplate>())).Returns(result); LetterTemplateLogic target = new LetterTemplateLogic(mockLetterTemplateLogic.Object); long actual = target.Save(new LetterTemplate()); Assert.AreEqual(result, actual); }
public void IsLetterNameExistsTest() { // Arrange var mockLetterTemplateRepository = new Mock <ILetterTemplateRepository>(); mockLetterTemplateRepository.Setup(f => f.IsLetterNameExists(It.IsAny <LetterTemplate>())).Returns(true); LetterTemplateLogic target = new LetterTemplateLogic(mockLetterTemplateRepository.Object); //Act bool actual = target.IsLetterNameExists(null); //Assert Assert.AreEqual(true, actual); }
public void GetLetterTemplateByIdTest() { // Arrange var mockLetterTemplateRepository = new Mock <ILetterTemplateRepository>(); LetterTemplate letterTemplateResult = new LetterTemplate(); mockLetterTemplateRepository.Setup(f => f.GetLetterTemplateById(It.IsAny <LetterTemplate>())).Returns(letterTemplateResult); LetterTemplateLogic target = new LetterTemplateLogic(mockLetterTemplateRepository.Object); //Act LetterTemplate actual = target.GetLetterTemplateById(null); //Assert Assert.AreEqual(letterTemplateResult, actual); }
public void AddEditLetterTemplate() { // Arrange var mockLetterTemplateRepository = new Mock <ILetterTemplateRepository>(); const long result = 2; mockLetterTemplateRepository.Setup(f => f.Save(It.IsAny <LetterTemplate>())).Returns(result); LetterTemplateLogic target = new LetterTemplateLogic(mockLetterTemplateRepository.Object); // Act long actual = target.Save(null); // Assert Assert.AreEqual(result, actual); }