Welcome to mirror list, hosted at ThFree Co, Russian Federation.

FrameworkAlternateTests.cs « mdoc.Test « mdoc - github.com/mono/api-doc-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1774ee89e951ee8f7dec3fedf44199bad7556ce3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
using Mono.Documentation.Updater.Frameworks;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;

namespace mdoc.Test
{
    [TestFixture ()]
    public class FrameworkAlternateTests
    {
        [Test ()]
        public void AddToEmptyList()
        {
            string newValue = FXUtils.AddFXToList ("", "One");

            Assert.AreEqual ("One", newValue);
        }

        [Test ()]
        public void AddToExistingList ()
        {
            string newValue = FXUtils.AddFXToList ("One", "Two");

            Assert.AreEqual ("One;Two", newValue);
        }

        [Test ()]
        public void AddDupeToExistingList ()
        {
            string newValue = FXUtils.AddFXToList ("One", "One");

            Assert.AreEqual ("One", newValue);
        }


        [Test ()]
        public void RemoveFromList()
        {
            string newValue = FXUtils.RemoveFXFromList ("One", "One");
            Assert.AreEqual ("", newValue);
        }


        [Test ()]
        public void RemoveFromMultiList ()
        {
            string existingValue = "Pre;One;Post";
            string fxToRemove = "One";
            string postValue = "Pre;Post";

            string newValue = FXUtils.RemoveFXFromList (existingValue, fxToRemove);
            Assert.AreEqual (postValue, newValue);

            // make sure the cache returns the same value
            newValue = FXUtils.RemoveFXFromList (existingValue, fxToRemove);
            Assert.AreEqual (postValue, newValue);
        }

        [Test ()]
        public void AddToMultiList ()
        {
            string existingValue = "Pre;Post";
            string fxToAdd = "One";
            string postValue = "Pre;Post;One";

            string newValue = FXUtils.AddFXToList (existingValue, fxToAdd);
            Assert.AreEqual (postValue, newValue);

            // make sure the cache returns the same value
            newValue = FXUtils.AddFXToList (existingValue, fxToAdd);
            Assert.AreEqual (postValue, newValue);
        }

        [Test]
        public void LastFramework()
        {
            List<FrameworkEntry> entries = new List<FrameworkEntry>();
            entries.Add (new FrameworkEntry (entries, entries));
            entries.Add (new FrameworkEntry (entries, entries));
            entries.Add (new FrameworkEntry (entries, entries));
            entries.Add (new FrameworkEntry (entries, entries));

            Assert.IsFalse (entries[0].IsLastFramework);
            Assert.IsFalse (entries[1].IsLastFramework);
            Assert.IsFalse (entries[2].IsLastFramework);
            Assert.IsTrue (entries[3].IsLastFramework);
        }

        [Test]
        public void FirstFramework ()
        {
            List<FrameworkEntry> entries = new List<FrameworkEntry> ();
            entries.Add (new FrameworkEntry (entries, entries));
            entries.Add (new FrameworkEntry (entries, entries));
            entries.Add (new FrameworkEntry (entries, entries));
            entries.Add (new FrameworkEntry (entries, entries));

            Assert.IsTrue (entries[0].IsFirstFramework);
            Assert.IsFalse (entries[1].IsFirstFramework);
            Assert.IsFalse (entries[2].IsFirstFramework);
            Assert.IsFalse (entries[3].IsFirstFramework);
        }
    }
}