public void Check_URL_Do_Not_Append() { var cacheMock = new Mock <IDataCache>(); var RepoMock = new Mock <IRepository>(); var urlExecutor = new SingleLayer(cacheMock.Object, RepoMock.Object); urlExecutor.SetUrl("https://tabish.com"); urlExecutor.Url.ShouldBe("https://tabish.com"); }
public void Check_URL_Remove_Html_Code() { var cacheMock = new Mock <IDataCache>(); var RepoMock = new Mock <IRepository>(); var urlExecutor = new SingleLayer(cacheMock.Object, RepoMock.Object); urlExecutor.SetUrl("https://tabish.com/first%2FSecond"); urlExecutor.Url.ShouldBe("https://tabish.com/first/second"); }
public void Check_URL_Empty_Validation_Fail() { var cacheMock = new Mock <IDataCache>(); var RepoMock = new Mock <IRepository>(); var urlExecutor = new SingleLayer(cacheMock.Object, RepoMock.Object); urlExecutor.SetUrl(""); bool result = urlExecutor.Validate(); result.ShouldBeFalse(); urlExecutor.ErrorMessages.Count.ShouldBe(1); }
public void Generate_Url_From_KeyCode() { string url = "https://tabish.com/first/Second"; var cacheMock = new Mock <IDataCache>(); var RepoMock = new Mock <IRepository>(); RepoMock.Setup(x => x.FindKey(It.IsAny <long>())).Returns(new TopLevelModel() { Id = 1, Url = url }); var urlExecutor = new SingleLayer(cacheMock.Object, RepoMock.Object); urlExecutor.SetUrl(url); var result = urlExecutor.GetLongUrl("b"); result.ShouldNotBeNullOrEmpty(); result.ShouldBe(url); }
public void Generate_KeyCode_From_Url() { var cacheMock = new Mock <IDataCache>(); var RepoMock = new Mock <IRepository>(); RepoMock.Setup(x => x.Add(It.IsAny <TopLevelModel>())).Returns(new TopLevelModel() { Id = 1 }); var urlExecutor = new SingleLayer(cacheMock.Object, RepoMock.Object); urlExecutor.SetUrl("https://tabish.com/first%2FSecond"); var result = urlExecutor.GetShortUrl(); result.ShouldNotBeNullOrEmpty(); result.ShouldBe("b"); }