public void GetComputerNames_GetComputerNamesImpl_ComputerNames_ShouldBeMoreThanZero() { var mockSecurityIdentityFactory = new Mock <ISecurityIdentityFactory>(); mockSecurityIdentityFactory.Setup(o => o.Current).Returns(() => null); var getComputerNames = new GetComputerNamesImpl(mockSecurityIdentityFactory.Object); var c = getComputerNames.ComputerNames.Count; mockSecurityIdentityFactory.VerifyGet(o => o.Current, Times.Once); Assert.IsTrue(c >= 1, "ComputerNames count should be greater than 1"); }
public void GetComputerNames_GetComputerNamesImpl_UpdateComputerNamesList() { var expectedList = new List <string>(); var mockSecurityIdentityFactory = new Mock <ISecurityIdentityFactory>(); var mockIdentity = new Mock <ISecurityIdentity>(); mockIdentity.Setup(o => o.GetHosts()).Returns(expectedList); mockSecurityIdentityFactory.Setup(o => o.Current).Returns(mockIdentity.Object); var getComputerNames = new GetComputerNamesImpl(mockSecurityIdentityFactory.Object); getComputerNames.GetComputerNamesList(); mockSecurityIdentityFactory.VerifyGet(o => o.Current, Times.Once); mockIdentity.Verify(o => o.GetHosts(), Times.Once); Assert.IsTrue(GetComputerNames.ComputerNames.Count >= 1, "ComputerNames count should be greater than 1"); }