public void CreateTextDocumentationEntryTest() { Mock <IGuidService> guidServiceMock = new Mock <IGuidService>(); Guid expectedGuid = Guid.Parse("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"); guidServiceMock.Setup(guidService => guidService.CreateNewGuid()) .Returns(expectedGuid); DocumentationEntryFactory factory = new DocumentationEntryFactory(guidServiceMock.Object); const string expectedText = "Facotry Method Test"; IDocumentationEntry result = factory.CreateTextDocumentationEntry(expectedText); Assert.IsType <TextDocumentationEntry>(result); Assert.Equal(expectedGuid, result.Identifier); Assert.Equal(expectedText, ((TextDocumentationEntry)result).Text); }
public void CreateUrlDocumentationEntryTest() { Mock <IGuidService> guidServiceMock = new Mock <IGuidService>(); Guid expectedGuid = Guid.Parse("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"); guidServiceMock.Setup(guidService => guidService.CreateNewGuid()) .Returns(expectedGuid); DocumentationEntryFactory factory = new DocumentationEntryFactory(guidServiceMock.Object); const string expectedUrl = "https://github.com/Leginiel/ValkyrDoc"; const string expectedDescription = "ValkyrDoc Github"; IDocumentationEntry result = factory.CreateUrlDocumentationEntry(expectedDescription, expectedUrl); Assert.IsType <UrlDocumentationEntry>(result); Assert.Equal(expectedGuid, result.Identifier); Assert.Equal(expectedUrl, ((UrlDocumentationEntry)result).Url); Assert.Equal(expectedDescription, ((UrlDocumentationEntry)result).Description); }