~jameinel/ubuntuone-windows-installer/readme_fixes

« back to all changes in this revision

Viewing changes to src/Canonical.Ubuntu.SSO.Tests/CredentialsFoundEventArgsFixture.cs

  • Committer: Manuel de la Pena
  • Date: 2010-10-12 10:06:34 UTC
  • mto: (84.3.2 u1sync_long_paths)
  • mto: This revision was merged to the branch mainline in revision 102.
  • Revision ID: mandel@themacaque.com-20101012100634-mox3bp8qpxhjrlnf
Increased test converage.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2010 Canonical Ltd.
 
3
 * 
 
4
 * This file is part of Ubuntu One on Windows.
 
5
 * 
 
6
 * Ubuntu One on Windows is free software: you can redistribute it and/or modify                
 
7
 * it under the terms of the GNU Lesser General Public License version          
 
8
 * as published by the Free Software Foundation.                
 
9
 *              
 
10
 * Ubuntu One on Windows is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        
 
13
 * GNU Lesser General Public License for more details.  
 
14
 *
 
15
 * You should have received a copy of the GNU Lesser General Public License     
 
16
 * along with Ubuntu One for Windows.  If not, see <http://www.gnu.org/licenses/>.
 
17
 * 
 
18
 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
 
19
 */
 
20
using System.Collections;
 
21
using System.Collections.Generic;
 
22
using NUnit.Framework;
 
23
 
 
24
namespace Canonical.Ubuntu.SSO.Tests
 
25
{
 
26
    [TestFixture]
 
27
    public class CredentialsFoundEventArgsFixture
 
28
    {
 
29
        #region Variables
 
30
 
 
31
        private CredentialsFoundEventArgs _args;
 
32
 
 
33
        #endregion
 
34
 
 
35
        #region Tests
 
36
 
 
37
        [Test]
 
38
        public void EmptyConstructorTest()
 
39
        {
 
40
            _args = new CredentialsFoundEventArgs();
 
41
            Assert.AreEqual(string.Empty, _args.ApplicationName);
 
42
            Assert.IsEmpty((ICollection)_args.Credentials.Values);
 
43
        }
 
44
 
 
45
        [TestCase("UbuntuOne", "token", "tokenSecret", "consumerKey", "consumerSecret")]
 
46
        [TestCase("Tomboy", "tomboyToken", "tomboyToeknSecret", "tomboyConsumerKey", "tomboyConsumerSecret")]
 
47
        public void AppNameCredentialsConstructor(string appName, string token, string tokenSecret, 
 
48
            string consumerKey, string consumerSecret )
 
49
        {
 
50
            // create the dict with the data
 
51
            var credentials = new Dictionary<string, string>
 
52
            {
 
53
                {"Token", token},
 
54
                {"TokenSecret", tokenSecret},
 
55
                {"ConsumerKey", consumerKey},
 
56
                {"ConsumerSecret", consumerSecret}
 
57
            };
 
58
            _args = new CredentialsFoundEventArgs(appName, credentials);
 
59
            Assert.AreEqual(appName, _args.ApplicationName);
 
60
            Assert.AreSame(credentials, _args.Credentials);
 
61
        }
 
62
 
 
63
        #endregion
 
64
    }
 
65
}