public When_requesting_Index_on_SpeakerController() { var theSpeaker = new User { Id = 1, FirstName = "Brandon", Username = "******" }; var theSpeakerList = new[] { theSpeaker }; var sessionService = new Moq.Mock <ISpeakerService>(); var httpContext = new Moq.Mock <IHttpContextAccessor>(); sessionService.Setup(x => x.GetSpeakerByUsername("test123")).Returns(theSpeaker); httpContext.Setup(x => x.HttpContext).Returns(new DefaultHttpContext { User = new System.Security.Claims.ClaimsPrincipal(new List <ClaimsIdentity> { new ClaimsIdentity(new List <Claim> { new Claim(ClaimTypes.Name, "test123") }) }) }); _controller = new SpeakerController(httpContext.Object, sessionService.Object); }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0) && showTextbox && !showChoice) { if (textCounter < textboxText.Length) { textCounter = textboxText.Length; displayedText = textboxText; } else { bool done = currentSpeaker.Next(); if (done) { showTextbox = false; currentSpeaker = null; } } } if (textCounter < textboxText.Length) { if (textTimer <= 0) { displayedText = string.Concat(displayedText, textboxText[textCounter]); textCounter++; textTimer = textPeriod; } else { textTimer -= Time.deltaTime; } } }
protected void OnDestroy() { this.connection.RemoveListener(SpeakerController.speakerPlaybackMessageID, this.listener); this.listener.Dispose(); Instance = null; }
public void ItHasSearch() { // Arrange var controller = new SpeakerController(); // Act controller.Search("Jos"); }
public void ItReturnsOkObjectResult() { var controller = new SpeakerController(); var result = controller.Search("Jos"); Assert.NotNull(result); //Поиск принес результат? Assert.IsType <OkObjectResult>(result); //Результат ОК? }
public void ItExists() { // Arrange var speakerServiceMock = new Mock <ISpeakerService>(); var controller = new SpeakerController(speakerServiceMock.Object); // Act controller.GetAll(); }
public void ItReturnsCollectionOfSpeakers() { var controller = new SpeakerController(); var result = controller.Search("Jos") as OkObjectResult; Assert.NotNull(result); Assert.NotNull(result.Value); Assert.IsType <List <Speaker> >(result.Value); }
private void Awake() { SpeakerController.Instance = this; prominentSpeakerList = new ProminentSpeakerInfo[AudioConstants.MaximumProminentSpeakers]; for (int prominentSpeaker = 0; prominentSpeaker < AudioConstants.MaximumProminentSpeakers; prominentSpeaker++) { this.prominentSpeakerList[prominentSpeaker] = new ProminentSpeakerInfo(); } }
public void NewTextbox(string content, Texture pic, SpeakerController speaker) { textboxText = content; displayedText = ""; textCounter = 0; textTimer = 0; showTextbox = true; currentSpeaker = speaker; currentPic = pic; }
public void ItAcceptsInterface() { // Arrange ISpeakerService testSpeakerService = new TestSpeakerService(); // Act var controller = new SpeakerController(testSpeakerService); // Assert Assert.NotNull(controller); }
public SearchForSpeakersTests() { _speakers = new List <Speaker> { new Speaker("test") }; _speakerServiceMock = new Mock <ISpeakerService>(); _speakerServiceMock.Setup(x => x.Search(It.IsAny <string>())).Returns(_speakers); _controller = new SpeakerController(_speakerServiceMock.Object); }
public void ItReturnsOkObjectResult() { // Arrange var controller = new SpeakerController(); // Act var result = controller.Search("Jos"); // Assert Assert.NotNull(result); Assert.IsType <OkObjectResult>(result); }
static void Main(string[] args) { AbstractContainer.AbsContainer = UnityInit.GetInstance(); RegistrationDependency(); var screenController = new ScreenController(); screenController.ShowMessage(); var speakerController = new SpeakerController(); speakerController.PlayMusic(); Console.ReadKey(); }
public async Task WhenSpeakerDoesNotExists_ReturnsBadRequest() { const string SPEAKER_NAME = "Scott Guthrie"; var service = Initialiser.ConferenceServiceFactory( SpeakerControllerResponses.NullSpeakerJsonResponse, SpeakerControllerResponses.SpeakerResponse(SPEAKER_NAME)); var sut = new SpeakerController(new NullLogger <SpeakerController>(), service); var result = await sut.ReadSessionsWithTopics(SPEAKER_NAME, new DateTime()) as ObjectResult; Assert.Contains("not found", result.Value.ToString()); Assert.Equal(400, result.StatusCode); }
public async Task WhenSpeakerNameNotEntered_ReturnsBadRequest() { string SPEAKER_NAME = string.Empty; var service = Initialiser.ConferenceServiceFactory( SpeakerControllerResponses.FoundSpeakerJsonResponse(SPEAKER_NAME), SpeakerControllerResponses.SpeakerResponse(SPEAKER_NAME)); var sut = new SpeakerController(new NullLogger <SpeakerController>(), service); var result = await sut.ReadSessionsWithTopics(SPEAKER_NAME, new DateTime()) as ObjectResult; Assert.Contains("is missing", result.Value.ToString()); Assert.Equal(400, result.StatusCode); }
public GetAll() { _speakers = new List <SpeakerSummary> { new SpeakerSummary { Name = "test" } }; _speakerServiceMock = new Mock <ISpeakerService>(); _speakerServiceMock.Setup(x => x.GetAll()) .Returns(() => _speakers); _controller = new SpeakerController(_speakerServiceMock.Object); }
public Get() { _speaker = new SpeakerDetail { Name = "Speaker" }; _speakerServiceMock = new Mock <ISpeakerService>(); _speakerServiceMock.Setup(x => x.Get(It.IsAny <int>())) .Returns(() => _speaker); _speakerServiceMock.Setup(x => x.Get(-1)) .Returns(() => throw new SpeakerNotFoundException()); _controller = new SpeakerController(_speakerServiceMock.Object); }
public async Task WhenSpeakerExists_ReturnsOkWithSpeakerInformation() { const string SPEAKER_NAME = "Scott Guthrie"; var service = Initialiser.ConferenceServiceFactory( SpeakerControllerResponses.FoundSpeakerJsonResponse(SPEAKER_NAME), SpeakerControllerResponses.SpeakerResponse(SPEAKER_NAME)); var sut = new SpeakerController(new NullLogger <SpeakerController>(), service); var result = await sut.ReadSessionsWithTopics(SPEAKER_NAME, new DateTime()) as OkObjectResult; Assert.IsType <Speaker>(result.Value); Assert.Equal(200, result.StatusCode); Assert.Equal(SPEAKER_NAME, ((Speaker)result.Value).Name); }
public SpeakerControllerSearchTests() { _speakers = new List<Speaker> { new Speaker { Name = "test" } }; // define the mock _speakerServiceMock = new Mock<ISpeakerService>(); // when search is called, return list of speakers containing speaker _speakerServiceMock.Setup(x => x.Search(It.IsAny<string>())) .Returns(() => _speakers); // pass mock object as ISpeakerService _controller = new SpeakerController(_speakerServiceMock.Object); }
public void CannotSeeSpeakerList_WhenTheConferenceSaysThatSpeakersCannotBeShown() { var conference = Substitute.For <IConference>(); conference.CanShowSpeakers().Returns(false); var conferenceLoader = Substitute.For <IConferenceLoader>(); conferenceLoader.LoadConference().Returns(conference); var sessionLoaderFactory = Substitute.For <ISessionLoaderFactory>(); var userProfileRepository = Substitute.For <IUserProfileRepository>(); var userProfileFilterFactory = Substitute.For <IUserProfileFilterFactory>(); var controller = new SpeakerController(conferenceLoader, sessionLoaderFactory, userProfileRepository, userProfileFilterFactory); var result = controller.Index(); Assert.That(result, Is.InstanceOf <HttpNotFoundResult>()); }
void OnGUI() { GUI.skin.box.fontSize = boxFontSize; GUI.skin.box.alignment = TextAnchor.UpperLeft; GUI.skin.box.normal.background = MakeTex(2, 2, new Color(0f, 0f, 0f)); GUI.skin.label.normal.background = MakeTex(2, 2, new Color(0f, 0f, 0f)); GUI.skin.button.normal.background = MakeTex(2, 2, new Color(0f, 0f, 0f)); if (showTextbox) { Rect textboxRect = new Rect(Screen.width * (1 - boxWidth) / 2, Screen.height * boxYPos, Screen.width * boxWidth, Screen.height * boxHeight); GUI.Box(textboxRect, displayedText); if (currentPic != null) { Rect picRect = new Rect(textboxRect.x, textboxRect.y - currentPic.height, currentPic.width, currentPic.height); GUI.DrawTexture(picRect, currentPic); } } if (showChoice) { for (int i = 0; i < currentChoices.Length; i++) { Rect buttonRect = new Rect((1 - (choiceRightMargin + choiceWidth)) * Screen.width, choiceYPos * Screen.height + choiceHeight * Screen.height * i, choiceWidth * Screen.width, choiceHeight * Screen.height); if (GUI.Button(buttonRect, currentChoices[i])) { showChoice = false; bool done = currentSpeaker.Next(i); if (done) { showTextbox = false; currentSpeaker = null; } } } } }
void Start() { speaker = GetComponent <SpeakerController>(); }
public void Setup() { controller = new SpeakerController(); }
public void NewChoice(string[] choices, SpeakerController speaker) { currentSpeaker = speaker; currentChoices = choices; showChoice = true; }
public SpeakerControllerSearchTests() { _controller = new SpeakerController(); }
public void ItExists() { var controller = new SpeakerController(); }
public void ItHasSearch() //Проверяем наличие метода Поиск { var controller = new SpeakerController(); controller.Search("Jos"); }