GetUser() public static method

Gets a default IWebHookUser implementation which is used if none are registered with the Dependency Injection engine.
public static GetUser ( ) : IWebHookUser
return IWebHookUser
コード例 #1
0
        public void GetUser_ReturnsSingleInstance()
        {
            // Act
            IWebHookUser actual1 = CustomServices.GetUser();
            IWebHookUser actual2 = CustomServices.GetUser();

            // Assert
            Assert.Same(actual1, actual2);
        }
コード例 #2
0
        public void SetUser_GetUser_Roundtrips()
        {
            // Arrange
            Mock <IWebHookUser> userMock = new Mock <IWebHookUser>();

            // Act
            CustomServices.SetUser(userMock.Object);
            IWebHookUser actual = CustomServices.GetUser();

            // Assert
            Assert.Same(userMock.Object, actual);
        }