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); }
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; }
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(); }
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(); }
public void should_throw_if_folder_being_added_doesnt_exist() { WithNonExistingFolder(); Assert.Throws <DirectoryNotFoundException>(() => Subject.Add(new RootFolder { Path = "C:\\TEST".AsOsAgnostic() })); }
public void should_add_if_indexer_is_different() { GivenHeldRelease(_release.Title, "AnotherIndexer", _release.PublishDate); Subject.Add(_temporarilyRejected); VerifyInsert(); }
public void when_single_word_is_added_then_trie_contains_word() { var word = "add"; Subject.Add(word); Assert.IsTrue(Subject.Contains(word)); }
public void should_add_if_title_is_different() { GivenHeldRelease(_release.Title + "-RP", _release.Indexer, _release.PublishDate); Subject.Add(_temporarilyRejected); VerifyInsert(); }
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); }
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); }
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); }
public void should_add_if_publish_date_is_different() { GivenHeldRelease(_release.Title, _release.Indexer, _release.PublishDate.AddHours(1)); Subject.Add(_temporarilyRejected); VerifyInsert(); }
public void Add(string addedText) { Check(password); if (loggedIn) { subject.Add(addedText); } }
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(); }
// Use this for initialization new void Start() { animator = this.gameObject.GetComponent <Animator>(); Subject publisher = Publisher.GetInstance(); publisher.Add(this); actionState = ActionState.IDLE; idle(); }
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); }
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()); }
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() })); }
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()); }
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}"); }
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}"); }
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); }
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); }
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); }
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); }
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 })); }
/// <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); }
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() })); }
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)); }