예제 #1
0
        public void Constructor_Missing_UserId()
        {
            var factory     = new Mock <IAuthenticationServiceFactory>().Object;
            var application = new VstsApplication("id", "secret", "scope", new Uri("http://localhost/redirect"), factory);

            Assert.ThrowsException <ArgumentNullException>(() => new LogOnCard(application, ChannelIds.Skype, null));
        }
예제 #2
0
        public void Constructor()
        {
            var factory     = new Mock <IAuthenticationServiceFactory>().Object;
            var application = new VstsApplication("id", "secret", "scope", new Uri("http://localhost/redirect"), factory);

            Assert.IsNotNull(new LogOnCard(application, ChannelIds.Skype, "userId"));
            Assert.IsNotNull(new LogOnCard(application, ChannelIds.Msteams, "userId"));
        }
예제 #3
0
        public void VstsApplicationPropertiesTest()
        {
            var id          = "id";
            var secret      = "secret";
            var scope       = "scope";
            var redirectUri = new Uri("http://localhost/redirect");

            var factoryMock = new Mock <IAuthenticationServiceFactory>();

            factoryMock
            .Setup(factory => factory.GetService(It.IsAny <IVstsApplication>()))
            .Returns(() => new Mock <IAuthenticationService>().Object);

            var sut = new VstsApplication(id, secret, scope, redirectUri, factoryMock.Object);

            Assert.AreEqual(id, sut.Id);
            Assert.AreEqual(secret, sut.Secret);
            Assert.AreEqual(scope, sut.Scope);
            Assert.AreEqual(redirectUri, sut.RedirectUri);
            Assert.IsNotNull(sut.AuthenticationService);
        }