Ejemplo n.º 1
0
    private void Start()
    {
        Subject  s  = new Subject();
        Oberver  o1 = new Oberver();
        Oberver  o2 = new Oberver();
        Oberver2 o3 = new Oberver2(10, 100);

        // 추가 삭제 마다 신호를 주게 만듬
        s.Add(o1);
        s.Add(o2);
        s.Remove(o1);
        s.Add(o3);
    }
Ejemplo n.º 2
0
        public SemesterScore(JHSemesterScoreRecord record)
            : this(record.SchoolYear, record.Semester)
        {
            RawScore = record;

            foreach (SubjectScore eachSubject in RawScore.Subjects.Values)
            {
                string subjName = eachSubject.Subject.Trim();

                if (!Subject.Contains(subjName))
                {
                    Subject.Add(subjName, new SemesterSubjectScore(eachSubject));
                }
            }

            foreach (DomainScore eachDomian in RawScore.Domains.Values)
            {
                string domainName = eachDomian.Domain;

                if (!Domain.Contains(domainName))
                {
                    Domain.Add(domainName, new SemesterDomainScore(eachDomian));
                }
            }

            CourseLearnScore = RawScore.CourseLearnScore;
            LearnDomainScore = RawScore.LearnDomainScore;
        }
Ejemplo n.º 3
0
        public void should_not_add_if_it_is_the_same_release_from_the_same_indexer()
        {
            GivenHeldRelease(_release.Title, _release.Indexer, _release.PublishDate);

            Subject.Add(_temporarilyRejected);

            VerifyNoInsert();
        }
Ejemplo n.º 4
0
 private void buttonAdd_Click(object sender, RoutedEventArgs e)
 {
     Tasks.Add(new TaskManager(textBox.Text));
     Subject.Add(new TaskManager(SubjectChooser.Text));
     textBox.Text        = "";
     SubjectChooser.Text = "";
     serializeTasks();
 }
Ejemplo n.º 5
0
        public void should_throw_if_folder_being_added_doesnt_exist()
        {
            WithNonExistingFolder();

            Assert.Throws <DirectoryNotFoundException>(() => Subject.Add(new RootFolder {
                Path = "C:\\TEST".AsOsAgnostic()
            }));
        }
Ejemplo n.º 6
0
        public void should_add_if_indexer_is_different()
        {
            GivenHeldRelease(_release.Title, "AnotherIndexer", _release.PublishDate);

            Subject.Add(_temporarilyRejected);

            VerifyInsert();
        }
Ejemplo n.º 7
0
            public void when_single_word_is_added_then_trie_contains_word()
            {
                var word = "add";

                Subject.Add(word);

                Assert.IsTrue(Subject.Contains(word));
            }
Ejemplo n.º 8
0
        public void should_add_if_title_is_different()
        {
            GivenHeldRelease(_release.Title + "-RP", _release.Indexer, _release.PublishDate);

            Subject.Add(_temporarilyRejected);

            VerifyInsert();
        }
Ejemplo n.º 9
0
        public void Add(byte a, byte b, byte expected, bool halfCarry, bool carry, bool overflow)
        {
            var result = Subject.Add(a, b);

            result.ShouldBe(expected);

            AssertFlags(result, null, null, halfCarry, overflow, false, carry);
        }
Ejemplo n.º 10
0
        public void Add16(ushort a, ushort b, ushort expected, bool halfCarry, bool carry)
        {
            var result = Subject.Add(a, b);

            result.ShouldBe(expected);

            AssertFlags(null, null, null, halfCarry, null, false, carry);
        }
Ejemplo n.º 11
0
        public void DecimalAdjustAddition(byte a, byte b, byte expected)
        {
            var result = Subject.Add(a, b);
            var daa    = Subject.DecimalAdjust(result, true);

            daa.ShouldBe(expected);
            _flags.Verify(x => x.SetResultFlags(expected), Times.AtLeastOnce);
        }
Ejemplo n.º 12
0
        public void should_add_if_publish_date_is_different()
        {
            GivenHeldRelease(_release.Title, _release.Indexer, _release.PublishDate.AddHours(1));

            Subject.Add(_temporarilyRejected);

            VerifyInsert();
        }
Ejemplo n.º 13
0
            public void Add(string addedText)
            {
                Check(password);

                if (loggedIn)
                {
                    subject.Add(addedText);
                }
            }
Ejemplo n.º 14
0
        public void should_not_add_if_it_is_the_same_release_from_the_same_indexer_twice()
        {
            GivenHeldRelease(_release.Title, _release.Indexer, _release.PublishDate, PendingReleaseReason.DownloadClientUnavailable);
            GivenHeldRelease(_release.Title, _release.Indexer, _release.PublishDate, PendingReleaseReason.Fallback);

            Subject.Add(_temporarilyRejected, PendingReleaseReason.Delay);

            VerifyNoInsert();
        }
Ejemplo n.º 15
0
    // Use this for initialization
    new void Start()
    {
        animator = this.gameObject.GetComponent <Animator>();
        Subject publisher = Publisher.GetInstance();

        publisher.Add(this);
        actionState = ActionState.IDLE;
        idle();
    }
Ejemplo n.º 16
0
            public void solves_phrase()
            {
                var words =
                    new[]
                {
                    "a",
                    "an",
                    "and",
                    "dad",
                    "da",
                    "dare",
                    "d",
                    "n",
                    "dn"
                };

                foreach (var word in words)
                {
                    Subject.Add(word);
                }

                var results = Subject.SolveAnagram("dan");

                var expected = new List <List <string> >
                {
                    new List <string>
                    {
                        "an",
                        "d"
                    },
                    new List <string>
                    {
                        "and"
                    },
                    new List <string>
                    {
                        "da",
                        "n"
                    },
                    new List <string>
                    {
                        "d",
                        "a",
                        "n"
                    },
                    new List <string>
                    {
                        "dn",
                        "a"
                    }
                };

                //currently returns duplicate combinations
                //e.g. {"dn" "a"} and {"a", "dn"}
                AssertPhrasesEqual(expected, results);
            }
Ejemplo n.º 17
0
        public void should_be_able_to_add_root_dir(string path)
        {
            var root = new RootFolder {
                Path = path.AsOsAgnostic()
            };

            Subject.Add(root);

            Mocker.GetMock <IRootFolderRepository>().Verify(c => c.Insert(root), Times.Once());
        }
Ejemplo n.º 18
0
        public void should_throw_when_adding_not_writable_folder()
        {
            Mocker.GetMock <IDiskProvider>()
            .Setup(m => m.FolderWritable(It.IsAny <string>()))
            .Returns(false);

            Assert.Throws <UnauthorizedAccessException>(() => Subject.Add(new RootFolder {
                Path = @"C:\Music".AsOsAgnostic()
            }));
        }
Ejemplo n.º 19
0
        public void should_remove_duplicate_if_it_is_the_same_release_from_the_same_indexer_twice()
        {
            GivenHeldRelease(_release.Title, _release.Indexer, _release.PublishDate, PendingReleaseReason.DownloadClientUnavailable);
            GivenHeldRelease(_release.Title, _release.Indexer, _release.PublishDate, PendingReleaseReason.Fallback);

            Subject.Add(_temporarilyRejected, PendingReleaseReason.Fallback);

            Mocker.GetMock <IPendingReleaseRepository>()
            .Verify(v => v.Delete(It.IsAny <int>()), Times.Once());
        }
Ejemplo n.º 20
0
        public void Add_WhenDifferentNumbersAdded_ReturnsCorrectCalculation(int left, int right)
        {
            //Arrange
            var expectedResult = left + right;

            //Act
            var result = Subject.Add(left, right);

            //Assert
            Assert.That(result, Is.EqualTo(expectedResult), $"Expected result equal to {expectedResult}");
        }
Ejemplo n.º 21
0
        public void Add_WhenSameNumberAdded_ReturnsZero()
        {
            //Arrange
            var expectedResult = 0;

            //Act
            var result = Subject.Add(1, 1);

            //Assert
            Assert.That(result, Is.EqualTo(expectedResult), $"Expected result equal to {expectedResult}");
        }
Ejemplo n.º 22
0
        private void GivenStartedDiskCommand()
        {
            var commandModel = Builder <CommandModel>
                               .CreateNew()
                               .With(c => c.Name   = "ProcessMonitoredDownloads")
                               .With(c => c.Body   = new ProcessMonitoredDownloadsCommand())
                               .With(c => c.Status = CommandStatus.Started)
                               .Build();

            Subject.Add(commandModel);
        }
Ejemplo n.º 23
0
        private void GivenStartedExclusiveCommand()
        {
            var commandModel = Builder <CommandModel>
                               .CreateNew()
                               .With(c => c.Name   = "ApplicationUpdate")
                               .With(c => c.Body   = new ApplicationUpdateCommand())
                               .With(c => c.Status = CommandStatus.Started)
                               .Build();

            Subject.Add(commandModel);
        }
Ejemplo n.º 24
0
        private void GivenStartedTypeExclusiveCommand()
        {
            var commandModel = Builder <CommandModel>
                               .CreateNew()
                               .With(c => c.Name   = "ImportListSync")
                               .With(c => c.Body   = new ImportListSyncCommand())
                               .With(c => c.Status = CommandStatus.Started)
                               .Build();

            Subject.Add(commandModel);
        }
Ejemplo n.º 25
0
        private void GivenStartedDiskCommand()
        {
            var commandModel = Builder <CommandModel>
                               .CreateNew()
                               .With(c => c.Name   = "CheckForFinishedDownload")
                               .With(c => c.Body   = new CheckForFinishedDownloadCommand())
                               .With(c => c.Status = CommandStatus.Started)
                               .Build();

            Subject.Add(commandModel);
        }
        public void When_adding_items_it_should_add_items_to_underlying_collection()
        {
            // Arrange
            var obj1 = new object();

            // Act
            Subject.Add(obj1);

            // Assert
            Verify <ICollection <object> >(e => e.Add(obj1), Times.Once);
        }
Ejemplo n.º 27
0
        public void should_throw_when_same_path_as_drone_factory()
        {
            var path = @"C:\TV".AsOsAgnostic();

            Mocker.GetMock <IConfigService>()
            .SetupGet(s => s.DownloadedEpisodesFolder)
            .Returns(path);

            Assert.Throws <InvalidOperationException>(() => Subject.Add(new RootFolder {
                Path = path
            }));
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Fluent (returns itself), add a lexica to the sentence, sentence logic applies here
        /// </summary>
        /// <param name="lex"></param>
        /// <returns></returns>
        public ILexicalSentence AddEvent(ISensoryEvent lex, bool recursive = true)
        {
            lex.Event.Context.Language = Language;

            //Contractive rules
            IDictata lexDict = lex.Event.GetDictata();

            foreach (IContractionRule contractionRule in Language.ContractionRules.Where(rul => rul.First == lexDict || rul.Second == lexDict))
            {
                if (!lex.Event.Modifiers.Any(mod => contractionRule.First.Equals(mod.GetDictata()) || contractionRule.Second.Equals(mod.GetDictata())))
                {
                    continue;
                }

                lex.Event.Modifiers.RemoveWhere(mod => contractionRule.First.Equals(mod.GetDictata()) || contractionRule.Second.Equals(mod.GetDictata()));

                lex.Event.Phrase = contractionRule.Contraction.Name;
            }

            //Sentence placement rules
            SentenceGrammarRule rule = Language.SentenceRules.FirstOrDefault(rul => rul.Type == Type && rul.Fragment == lex.Event.Role);

            if (rule != null)
            {
                //subject
                if (rule.SubjectPredicate)
                {
                    Subject.Add(new Tuple <ISensoryEvent, short>(lex, rule.ModificationOrder));
                }
                else
                {
                    Predicate.Add(new Tuple <ISensoryEvent, short>(lex, rule.ModificationOrder));
                }
            }
            else
            {
                Modifiers.Add(new Tuple <ISensoryEvent, short>(lex, 99));
            }

            if (recursive)
            {
                HashSet <ILexica> newMods = new HashSet <ILexica>();
                foreach (ILexica mod in lex.Event.Modifiers.Where(mod => mod.Role != GrammaticalType.None && mod.Role != GrammaticalType.Descriptive))
                {
                    AddEvent(new SensoryEvent(mod, lex.Strength, lex.SensoryType));
                    newMods.Add(mod);
                }

                lex.Event.Modifiers.RemoveWhere(modi => newMods.Any(mods => mods.Equals(modi)));
            }

            return(this);
        }
Ejemplo n.º 29
0
        public void adding_duplicated_root_folder_should_throw()
        {
            Mocker.GetMock <IRootFolderRepository>().Setup(c => c.All()).Returns(new List <RootFolder> {
                new RootFolder {
                    Path = "C:\\TV".AsOsAgnostic()
                }
            });

            Assert.Throws <InvalidOperationException>(() => Subject.Add(new RootFolder {
                Path = @"C:\TV".AsOsAgnostic()
            }));
        }
Ejemplo n.º 30
0
        public void adding_duplicated_mapping_should_throw(string host, string remotePath, string localPath)
        {
            localPath = localPath.AsOsAgnostic();

            GivenMapping();

            var mapping = new RemotePathMapping {
                Host = host, RemotePath = remotePath, LocalPath = localPath
            };

            Assert.Throws <InvalidOperationException>(() => Subject.Add(mapping));
        }