Exemple #1
0
        public void TestResourceXamlNonNullEmpty()
        {
            //arrange
            var expectedServerName         = "someServerName";
            var expectedUserName           = "******";
            var expectedPassword           = "******";
            var expectedAuthenticationType = AuthenticationType.User;
            var expectedValueMock          = new Mock <IContextualResourceModel>();
            var source = new SharepointSource()
            {
                Server             = expectedServerName,
                UserName           = expectedUserName,
                Password           = expectedPassword,
                AuthenticationType = expectedAuthenticationType
            };
            var xaml = new StringBuilder(source.ToXml().ToString());

            expectedValueMock.SetupGet(it => it.WorkflowXaml).Returns(xaml);
            _changedProperties.Clear();

            //act
            _target.Resource = expectedValueMock.Object;
            var actualValue = _target.Resource;

            //assert
            Assert.AreSame(expectedValueMock.Object, actualValue);
            Assert.AreEqual(expectedServerName, _target.ServerName);
            Assert.AreEqual(expectedUserName, _target.UserName);
            Assert.AreEqual(expectedPassword, _target.Password);
            Assert.AreEqual(expectedAuthenticationType, _target.AuthenticationType);
        }
        public void SharePointSource_ShouldHaveConstructorAndSetDefaultValues()
        {
            var sharepointSource = new SharepointSource();

            Assert.IsNotNull(sharepointSource);
            Assert.AreEqual("SharepointServerSource", sharepointSource.ResourceType);
            sharepointSource.AuthenticationType = AuthenticationType.User;
            var xElement = sharepointSource.ToXml();

            Assert.IsNotNull(xElement);
        }
Exemple #3
0
        public void TestResourceXamlNullEmpty()
        {
            //arrange
            var expectedServerName         = "someServerName";
            var expectedUserName           = "******";
            var expectedPassword           = "******";
            var expectedAuthenticationType = AuthenticationType.User;
            var expectedValueMock          = new Mock <IContextualResourceModel>();
            var source = new SharepointSource()
            {
                Server             = expectedServerName,
                UserName           = expectedUserName,
                Password           = expectedPassword,
                AuthenticationType = expectedAuthenticationType
            };
            var xaml = new StringBuilder(source.ToXml().ToString());


            expectedValueMock.SetupGet(it => it.WorkflowXaml).Returns(new StringBuilder());
            var resourceId = Guid.NewGuid();

            expectedValueMock.SetupGet(it => it.ID).Returns(resourceId);
            var resourceRepositoryMock = new Mock <IResourceRepository>();

            resourceRepositoryMock.Setup(
                it => it.FetchResourceDefinition(_environmentMock.Object, It.IsAny <Guid>(), resourceId, false))
            .Returns(new ExecuteMessage()
            {
                Message = xaml, HasError = false
            });
            _environmentMock.SetupGet(it => it.ResourceRepository).Returns(resourceRepositoryMock.Object);
            _changedProperties.Clear();

            //act
            _target.Resource = expectedValueMock.Object;
            var actualValue = _target.Resource;

            //assert
            Assert.AreSame(expectedValueMock.Object, actualValue);
            Assert.AreEqual(expectedServerName, _target.ServerName);
            Assert.AreEqual(expectedUserName, _target.UserName);
            Assert.AreEqual(expectedPassword, _target.Password);
            Assert.AreEqual(expectedAuthenticationType, _target.AuthenticationType);
        }