protected override void OnArrange() { base.OnArrange(); CardUpdateEvent = new CardUpdateEvent(DateTime.Now, TestCard, TestCard.Clone()); CardUpdateEvent.UpdatedCard.Description = NewValue; TestConfig.Mappings.ForEach(x => x.UpdateTargetItems = false); }
protected override void OnArrange() { base.OnArrange(); CardUpdateEvent = new CardUpdateEvent(DateTime.Now, TestCard, TestCard.Clone()); CardUpdateEvent.UpdatedCard.Priority = NewPriority; TestConfig.Mappings.ForEach(x => x.UpdateTargetItems = true); }
public Program() { WebSocketServer webSocketServer = new WebSocketServer(IPAddress.Any, 8081); TestCard testCard = new TestCard(WIDTH, HEIGHT, FPS); Timer sendTimer = new Timer((state) => { if (!SendBuffer.IsEmpty && ConnectedPeer != null && ConnectedPeer.connectionState == RTCPeerConnectionState.connected) { byte[] imageData; if (!SendBuffer.TryDequeue(out imageData)) { return; } SendFrame(90000 / FPS, imageData); } }, null, 0, 33); webSocketServer.AddWebSocketService <WebRTCWebSocketPeer>("/", (peer) => peer.CreatePeerConnection = CreatePeerConnection); webSocketServer.Start(); Console.WriteLine("Started WebRTC Server."); Codec = new H264Codec(WIDTH, HEIGHT, FPS, OnImageEncoded); Console.WriteLine("Initialized Codec."); testCard.ReceivedYUVFrame += TestCard_ReceivedYUVFrame; Console.WriteLine("TestCard is now sending frames."); Console.ReadKey(); }
public void ThrowsOnNullCard() { var hand = new Hand <TestCard>(TestCard.Factory(5)); var ex = Assert.Throws <ArgumentNullException>(() => hand.Add(card: null)); Assert.Equal(expected: "card", actual: ex.ParamName); }
protected override void OnArrange() { base.OnArrange(); CardUpdateEvent = new CardUpdateEvent(DateTime.Now, TestCard, TestCard.Clone()); CardUpdateEvent.UpdatedCard.Description = NewValue; CardUpdateEvent.UpdatedCard.ExternalCardID = null; TestConfig.Mappings.ForEach(x => x.UpdateCards = true); }
public void Test_TestCard() { TestCard testCard = new TestCard("Test", 20, "img.png"); Assert.AreEqual(testCard.name, "Test"); Assert.AreEqual(testCard.minBids, 20); Assert.AreEqual(testCard.asset, "img.png"); }
public void DecreasesPileByOne() { var hand = new Hand <TestCard>(TestCard.Factory(5)); var priorSize = hand.Count; var taken = hand.TakeAt(index: 3); Assert.NotNull(taken); Assert.Equal(expected: priorSize - 1, actual: hand.Count); }
public void IncreasesPileByOne() { var hand = new Hand <TestCard>(TestCard.Factory(5)); var priorSize = hand.Count; var newcard = new TestCard(id: 1); hand.Add(newcard); Assert.Equal(expected: priorSize + 1, actual: hand.Count); }
public void DoesNotChangeHandSize() { var hand = new Hand <TestCard>(TestCard.Factory(5)); var cards = hand.Browse(); Assert.False(cards.IsDefault); Assert.NotEmpty(cards); Assert.Equal(expected: cards.Length, actual: hand.Count); }
public void Activate_TapAbility_CardTapped() { var card = new TestCard(); card.TapAbility = new TestAbility() { Taps = true }; card.TapAbility.Owner = card; card.TapAbility.Activate(null, card); Assert.IsTrue(card.IsTapped); }
public void Activate_NoTapAbility_CardUnTapped() { var card = new TestCard(); card.TapAbility = new TestAbility() { Taps = false }; card.TapAbility.Owner = card; card.TapAbility.Activate(null, card); Assert.IsFalse(card.IsTapped); }
/// <summary> /// Starts the listen. /// </summary> public void StartListen() { if (!_RTSPServerListener.Server.Connected) { _RTSPServerListener = new TcpListener(IPAddress.Any, 8554); } _RTSPServerListener.Start(); _Stopping = new ManualResetEvent(false); _ListenTread = new Thread(new ThreadStart(AcceptConnection)); _ListenTread.Start(); // Initialise the H264 encoder h264_encoder = new SimpleH264Encoder(h264_width, h264_height, h264_fps); //h264_encoder = new TinyH264Encoder(); // hard coded to 192x128 ////-------------------------------------------- //// Start the VideoSource video_sourceT = new TestCard(h264_width, h264_height, h264_fps); video_sourceT.ReceivedYUVFrame += video_source_ReceivedYUVFrame; ////-------------------------------------------- ////--------------------------------------------------------- //videoSourceR = new VideoFileReader(); //videoSourceR.Open("rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa"); //video_sourceT = new TestCard(videoSourceR.ReadVideoFrame().Width, videoSourceR.ReadVideoFrame().Height, h264_fps); //video_sourceT.ReceivedYUVFrame += //video_source_ReceivedYUVFrame(new uint(), videoSourceR.ReadVideoFrame().Width, videoSourceR.ReadVideoFrame().Height, (byte[])new ImageConverter().ConvertTo(videoSourceR.ReadVideoFrame(), typeof(byte[])) ); //-------------------------------------------------------- // Start the VideoSource //video_source = new VideoFileSource("rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa"); //video_source.Start(); //video_source.Stop(); ////video_source = new VideoFileSource("rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa"); ////video_source.Start(); ////video_source_ReceivedYUVFrame(System.TimeSpan.FromMilliseconds, video_source.GetDescription<DataGridViewColumnHeadersHeightSizeMode>, video_source.Save()); //foreach (RTSPConnection connection in rtsp_list.ToArray()) //{ // int video_channel = connection.video_transport_reply.Interleaved.First; // connection.listener.BeginSendData(video_channel,video_source.Save(), new AsyncCallback(connection.listener.EndSendData), new object()); //} }
public void ThrowsTooHighIndex() { var hand = new Hand <TestCard>(TestCard.Factory(5)); var priorSize = hand.Count; var ex = Assert.Throws <ArgumentOutOfRangeException>(() => hand.TakeAt(index: hand.Count + 1)); Assert.StartsWith(expectedStartString: ErrorStrings.RetrievalTooHighH, actualString: ex.Message); Assert.Equal(expected: "index", actual: ex.ParamName); Assert.Equal(expected: priorSize, actual: hand.Count); }
public void ThrowsOnNullFuncReturn() { var hand = new Hand <TestCard>(TestCard.Factory(5)); var priorSize = hand.Count; var ex = Assert.Throws <InvalidOperationException>(() => hand.Order(orderFunc: cards => null)); Assert.Equal(expected: ErrorStrings.NewSequenceNull, actual: ex.Message); Assert.Equal(expected: priorSize, actual: hand.Count); }
public void ThrowsOnNullFunc() { var hand = new Hand <TestCard>(TestCard.Factory(5)); var priorSize = hand.Count; var ex = Assert.Throws <ArgumentNullException>(() => hand.Order(orderFunc: null)); Assert.Equal(expected: "orderFunc", actual: ex.ParamName); Assert.Equal(expected: priorSize, actual: hand.Count); }
public void PredicateThrowsOnNullPredicate() { var hand = new Hand <TestCard>(TestCard.Factory(5)); var priorSize = hand.Count; var ex = Assert.Throws <ArgumentNullException>(() => hand.TakeFirstOrDefault(predicate: null)); Assert.Equal(expected: "predicate", actual: ex.ParamName); Assert.Equal(expected: priorSize, actual: hand.Count); }
public TestCardItemUC(TestCard testCard, ITestCardItemSubscriber subsciber) { InitializeComponent(); Init(testCard); SubscribeToEvents(subsciber); url = testCard.url; testID = testCard.testID; isActive = testCard.isActive; }
public void EmptiesHand() { var hand = new Hand <TestCard>(TestCard.Factory(5)); var priorSize = hand.Count; var cleared = hand.Clear(); Assert.False(cleared.IsDefault); Assert.Equal(expected: 0, actual: hand.Count); Assert.Equal(expected: priorSize, actual: cleared.Length); }
public ActionResult DrawCard() { TestCard card = testDeck.DrawCard(); if (card != null) { return(Content("The card you drew was " + card.CardName)); } return(Content("There were no cards remaining in the deck")); }
public void TestCard_CreatedWithGiven_WillHaveTheVariables() { var test = new TestCard("Test Card", "Test of Valor", " ", 3); test.display(); Assert.AreEqual("Test Card", test.type); Assert.AreEqual("Test of Valor", test.name); Assert.AreEqual(" ", test.texturePath); Assert.AreEqual(3, test.minimum); // Use the Assert class to test conditions. }
public void SeedingCtorFiltersOutNulls() { var seed = TestCard.Factory(5).ToArray(); seed[1] = null; seed[3] = null; var nulls = seed.Count(c => c == null); var hand = new Hand <TestCard>(seed); Assert.Equal(expected: seed.Length - nulls, actual: hand.Count); Assert.All(hand.Browse(), c => Assert.NotNull(c)); }
protected List <TestCard> extractTests(List <Card> hand) { List <TestCard> testCards = new List <TestCard>(); for (int i = 0; i < hand.Count; i++) { if (hand [i] is TestCard) { TestCard currTest = (TestCard)hand [i]; testCards.Add(currTest); } } return(testCards); }
/// <summary> /// Starts the listen. /// </summary> public void StartListen() { _RTSPServerListener.Start(); _Stopping = new ManualResetEvent(false); _ListenTread = new Thread(new ThreadStart(AcceptConnection)); _ListenTread.Start(); // Initialise the H264 encoder h264_encoder = new SimpleH264Encoder(h264_width, h264_height, h264_fps); // Start the VideoSource video_source = new TestCard(h264_width, h264_height, h264_fps); video_source.ReceivedYUVFrame += video_source_ReceivedYUVFrame; }
/// <summary> /// Starts the listen. /// </summary> public void StartListen() { _RTSPServerListener.Start(); _Stopping = new ManualResetEvent(false); _ListenTread = new Thread(new ThreadStart(AcceptConnection)); _ListenTread.Start(); // Initialise the H264 encoder h264_encoder = new TinyH264Encoder(); // Start the VideoSource video_source = new TestCard(128, 96, 6); video_source.ReceivedYUVFrame += video_source_ReceivedYUVFrame; }
public void NonMatchingPredicateReturnsNull() { var hand = new Hand <TestCard>(TestCard.Factory(5)); var priorSize = hand.Count; bool funcCalled = false; var taken = hand.TakeFirstOrDefault(predicate: c => { funcCalled = true; return(c.Id == 10); }); Assert.True(funcCalled); Assert.Null(taken); Assert.Equal(expected: priorSize, actual: hand.Count); }
private void Server_GetTestsResponse(List <List <object> > obj) { Dispatcher.Invoke(delegate() { AvailableTestList = obj; TestsView.Children.Cast <TestCard>().ToList().ForEach(x => x.LoadTest -= Test_LoadTest); TestsView.Children.Clear(); foreach (List <object> param in obj) { TestCard test = new TestCard(param); test.LoadTest += Test_LoadTest; TestsView.Children.Add(test); } SortBySelectedTag(); }); }
TestCard IDeck.DrawCard() { List <TestCard> availableCards = context.TestCards.Where(tc => !tc.IsDrawn).ToList(); if (availableCards.Count == 0) { return(null); } Random r = new Random(); int drawnCardIndex = r.Next(availableCards.Count); TestCard drawnCard = availableCards[drawnCardIndex]; drawnCard.IsDrawn = true; context.SaveChanges(); return(drawnCard); }
// Sorts teh list of tests by ASCENDING order of minimum public List <Card> sortTetstsbyAscendingOrder(List <Card> tests) { for (int x = 0; x < tests.Count; x++) { for (int i = 0; i < (tests.Count - 1); i++) { TestCard test1 = (TestCard)tests[i]; TestCard test2 = (TestCard)tests[i + 1]; if (test1.minimum < test2.minimum) { var temp = tests[i + 1]; tests[i + 1] = tests[i]; tests[i] = temp; } } } return(tests); }
private void SearchNameInput_TextChanged(object sender, TextChangedEventArgs e) { TestsView.Children.Cast <TestCard>().ToList().ForEach(x => x.LoadTest -= Test_LoadTest); TestsView.Children.Clear(); List <List <object> > elements = AvailableTestList; if (SearchNameInput.Text != string.Empty) { elements = AvailableTestList.Where(x => (x[1] as string).Contains(SearchNameInput.Text)).ToList(); } foreach (List <object> testParam in elements) { TestCard test = new TestCard(testParam); test.LoadTest += Test_LoadTest; TestsView.Children.Add(test); } }
private void SortBySelectedTag() { TestsView.Children.Cast <TestCard>().ToList().ForEach(x => x.LoadTest -= Test_LoadTest); TestsView.Children.Clear(); List <List <object> > elements = AvailableTestList; if (TagComboBox.SelectedIndex != 0) { elements = AvailableTestList.Where(x => (x[5] as List <int>).Contains(TagComboBox.SelectedIndex + 1)).ToList(); } foreach (List <object> testParam in elements) { TestCard test = new TestCard(testParam); test.LoadTest += Test_LoadTest; TestsView.Children.Add(test); } }
public void FuncDoesNotGiveDefaultArray() { const int init = 0; const int added = 5; var hand = new Hand <TestCard>(); bool funcCalled = false; hand.Order(orderFunc: cards => { funcCalled = true; Assert.False(cards.IsDefault); return(cards.Concat(TestCard.Factory(added))); }); Assert.True(funcCalled); Assert.Equal(expected: init + added, actual: hand.Count); }
private void CardOrganizationTest() { Card[] testcards = new Card[8]; testcards[0] = new TestCard(0); testcards[1] = null; testcards[2] = new TestCard(10); testcards[3] = null; testcards[4] = null; testcards[5] = new TestCard(20); testcards[6] = null; Debug.Log(testcards[0]); Debug.Log(testcards[0] == null); Debug.Log(testcards[1]); PrintAllCards(testcards); ShuffleUpCardsIndex(testcards); PrintAllCards(testcards); }
public override List <AdventureCard> NextBid(TestCard testCard, Hand hand) { int targetBid = testCard.HighestBid; List <AdventureCard> bids = new List <AdventureCard>(); int bidValue = 0; foreach (AdventureCard card in hand.AdventureCards) { if (card is FoeCard) { bids.Add(card); bidValue += card.BidValue; } } if (bidValue <= targetBid) { bids.Clear(); } hand.Player.Match.Log(hand.Player.Username + " bids " + Utils.Stringify.CommaList <AdventureCard>(bids)); return(bids); }