public IEnumerator TestAssetReferenceTMethod() { yield return(ValidateTestDependency()); PreInstall(); Container.BindAsync <GameObject>() .FromAssetReferenceT(addressablePrefabReference) .AsCached(); PostInstall(); AddressableInject <GameObject> asyncPrefab = Container.Resolve <AddressableInject <GameObject> >(); int frameCounter = 0; while (!asyncPrefab.HasResult && !asyncPrefab.IsFaulted) { frameCounter++; if (frameCounter > 10000) { Assert.Fail(); } yield return(null); } Addressables.Release(asyncPrefab.AssetReferenceHandle); Assert.Pass(); }
//[ExpectedException(typeof(System.Reflection.TargetInvocationException))] public void PlayingCardWithInsufficientManaShouldFailTest() { IList <Card> hand = new List <Card> { new Card(4), new Card(4), new Card(4), }; Player player = new Player("Test", null, new List <Card>(), hand, mana: 3); PrivateObject playerO = new PrivateObject(player); try { playerO.Invoke("PlayCard", new Card(4), new StartingPlayerChooser().ChooseBetween(testPlayer, testPlayer), ActionType.DAMAGE); } catch (Exception ex) { if (ex.InnerException.Message.Contains("Insufficient Mana")) { Assert.Pass(); } else { Assert.Fail("Wskazany błąd nie zawiera frazy 'Insufficient Mana'"); } } }
public void Actual(DataTestCase testCase) { Data.InitMarketData(testCase.Vol, testCase.Rate, testCase.EvalDate); var pricingCfg = new PricingConfiguration(testCase.GreekTypes); var pricer = new Pricer(); PricingResults expectedResults = null; var actualResults = pricer.Results(testCase.Option, pricingCfg); var error = string.Empty; try { using (StreamReader file = File.OpenText(@"C:\Users\AHMED\source\repos\ConsoleApp1\ResultPricing.text")) { JsonSerializer serializer = new JsonSerializer(); expectedResults = (PricingResults)serializer.Deserialize(file, typeof(PricingResults)); } } catch (Exception e) { Assert.Fail(error = string.Format("Not Deserialize result: {0}", e.Message)); } if (actualResults.CompareResult(expectedResults)) { Assert.Pass("No regression detected"); } else { // save ecart Assert.Fail("regression detected"); } }
public void AddForm_Test() { try { List <QuestionDTO> q = new List <QuestionDTO>(); List <AnswerDTO> a = new List <AnswerDTO>(); a.Add(new AnswerDTO { Answer = "a", AnswerID = 20 }); q.Add(new QuestionDTO { QuestionID = 1, Question = "why?", Answers = a }); FormDetailDTO f = new FormDetailDTO() { Id = 4, Username = "******", Deadline = "3", Category = "category1", Title = "Title1", State = "open", NrVotes = 100, Questions = q }; _formLogic.AddForm(f); } catch (Exception) { Assert.Pass(); } Assert.Fail(); }
//Validate Deletion internal void ValidateDeleteCertification() { try { String expectedValue1 = ExcelLibHelper.ReadData(4, "Certificate"); //get the table list IList <IWebElement> Tablerows = driver.FindElements(By.XPath("//form/div[5]/div/div[2]/div/table/tbody/tr")); for (int i = 1; i <= Tablerows.Count; i++) { string actualvalue1 = driver.FindElement(By.XPath("//form/div[5]/div/div[2]/div/table/tbody[" + i + "]/tr/td[1]")).Text; //check if expected value is equal to actual value if (expectedValue1 != actualvalue1) { SaveScreenShotClass save = new SaveScreenShotClass(); string img = save.SaveScreenshot(driver, "CerficationsDeleted"); Assert.Pass(); Console.WriteLine("Certification deleted"); } } } catch (Exception e) { Console.WriteLine(e.Message); } }
public void WhenAUserAttemptsToOrderAnItemWithAQuantityOfZeroThrowInvalidOrderException() { var shoppingCart = new ShoppingCart(); shoppingCart.Items.Add(new ShoppingCartItem { ItemId = Guid.NewGuid(), Quantity = 0 }); var customerId = Guid.NewGuid(); var expectedOrderId = Guid.NewGuid(); Mock.Arrange(() => _orderDataService.Save(Arg.IsAny <Order>())) .Returns(expectedOrderId) .OccursNever(); // Act try { _orderService.PlaceOrder(customerId, shoppingCart); } catch { // Assert Mock.Assert(_orderDataService); Assert.Pass(); } Assert.Fail(); }
public void TestRealFullShow() { var show = new ShowService(new HttpClientWrapper()).GetFullShow(1); show.Wait(); var showObj = _jsonSerializeService.DeserializeObject <FullShowDto>(show.Result); Assert.Pass(); }
public void Create_User_Get_Same_User() { var userName = "******"; var email = "*****@*****.**"; var userManager = (CustomUserManager <ApplicationUser>)_provider.GetRequiredService( typeof(CustomUserManager <ApplicationUser>)); var result = userManager.CreateAsync(new ApplicationUser(userName, email)).Result; if (!result.Succeeded) { Assert.Fail(result.Errors.ToString()); } var userFromMail = userManager.FindByEmailAsync("*****@*****.**").Result; if (userFromMail == null) { Assert.Fail("User from mail has failed."); } if (userFromMail.UserName != userName || userFromMail.Email != email) { Assert.Fail("Username or email is corrupted."); } var userFromUsername = userManager.FindByNameAsync("Bob").Result; if (userFromUsername == null) { Assert.Fail("User from name has failed."); } if (userFromUsername.UserName != userName || userFromUsername.Email != email) { Assert.Fail("Username or email is corrupted."); } var userFromId = userManager.FindByIdAsync(userFromMail.Id).Result; if (userFromId.UserName != userName || userFromId.Email != email) { Assert.Fail("Username or email is corrupted."); } if (userFromId == null) { Assert.Fail("User from Id has failed."); } Assert.Pass(); }
public void GetUserForms_Test2() { try { _formLogic.GetUserForms("user22", 0, 5, "open"); } catch (Exception) { Assert.Pass(); } Assert.Fail(); }
public void GetContentForm_Test3() { try { _formLogic.GetContentForm(-3); } catch (Exception) { Assert.Pass(); } Assert.Fail(); }
public void GetVotedForms_Test4() { try { _formLogic.GetVotedForms("asdasd", 0, 1, "all"); } catch (Exception) { Assert.Pass(); } Assert.Fail(); }
public void GetUsername_Test4() { try { _formLogic.GetUsername(-100); } catch (Exception) { Assert.Pass(); } Assert.Fail(); }
public void GetCategoryForms_Test3() { try { _formLogic.GetCategoryForms(1, "asdas", 0, 5, "all"); } catch (Exception) { Assert.Pass(); } Assert.Fail(); }
public void GetQuestionID_Test3() { try { _formLogic.GetQuestionID("question11", -1); } catch (Exception) { Assert.Pass(); } Assert.Fail(); }
public void GetCategory_Test4() { try { _formLogic.GetCategory(100); } catch (Exception) { Assert.Pass(); } Assert.Fail(); }
public void GetAllForms_Test5() { try { _formLogic.GetAllForms("asd1", "Title", 0, 5, "all"); } catch (Exception) { Assert.Pass(); } Assert.Fail(); }
public void GetDetailResultForm_Test4() { try { _formLogic.GetDetailResultForm(-10); } catch (Exception) { Assert.Pass(); } Assert.Fail(); }
public void GetForm_Test3() { try { int id = _formLogic.GetForm(100).FormID; } catch (Exception) { Assert.Pass(); } Assert.Fail(); }
public void GetQuestionID_Test2() { try { _formLogic.GetQuestionID("asdasd", 1); } catch (Exception) { Assert.Pass(); } Assert.Fail(); }
public void GetCategoryID_Test() { try { _formLogic.GetCategoryID("asdasd"); } catch (Exception) { Assert.Pass(); } Assert.Fail(); }
public void DeleteCategory_Test2() { try { _categoryLogic.DeleteCategory(5); } catch (Exception) { Assert.Pass(); } Assert.Fail(); }
public void DeleteUser_Test3() { try { _userLogic.DeleteUser(10); } catch (Exception) { Assert.Pass(); } Assert.Fail(); }
public void GetUserRole_Test3() { try { _userLogic.GetUserRole("user4"); } catch (Exception) { Assert.Pass(); } Assert.Fail(); }
public void GetUser_Test2() { try { _userLogic.GetUser(-1); } catch (Exception) { Assert.Pass(); } Assert.Fail(); }
public void DeleteForm_Test2() { Assert.AreEqual(3, _formLogic.GetAllForms("1", "Title", 0, 5, "all").Count); try { _formLogic.DeleteForm(-1); } catch (Exception) { Assert.Pass(); } Assert.AreEqual(3, _formLogic.GetAllForms("1", "Title", 0, 5, "all").Count); }
public async Task PrepareStringsAsyncTest() { var validFilePath = @".\TestFiles\valid.nc"; var preparer = new GCodePreparer(); await preparer.OpenFileAsync(validFilePath, new Progress <float>()); try { await preparer.PrepareStringsAsync(); } catch (Exception ex) { Assert.Fail(ex.Message); } Assert.Pass(); }
public IEnumerator TestAddressableAsyncLoad() { yield return(ValidateTestDependency()); PreInstall(); AsyncOperationHandle <GameObject> handle = default; Container.BindAsync <GameObject>().FromMethod(async() => { try { var locationsHandle = Addressables.LoadResourceLocationsAsync("TestAddressablePrefab"); await locationsHandle.Task; Assert.Greater(locationsHandle.Result.Count, 0, "Key required for test is not configured. Check Readme.txt in addressable test folder"); IResourceLocation location = locationsHandle.Result[0]; handle = Addressables.LoadAsset <GameObject>(location); await handle.Task; return(handle.Result); } catch (InvalidKeyException) { } return(null); }).AsCached(); PostInstall(); yield return(null); AsyncInject <GameObject> asycFoo = Container.Resolve <AsyncInject <GameObject> >(); int frameCounter = 0; while (!asycFoo.HasResult && !asycFoo.IsFaulted) { frameCounter++; if (frameCounter > 10000) { Addressables.Release(handle); Assert.Fail(); } yield return(null); } Addressables.Release(handle); Assert.Pass(); }
public void ShouldPlayAsManyCardsAsPossibleForMaximumDamageTest() { IEnumerable <Card> cards = new[] { new Card(1), new Card(2), new Card(3), }; Move move = strategy.NextMove(3, 30, cards); if (move.Card.Value == 1 || move.Card.Value == 2) { Assert.Pass(); } else { Assert.Fail("Strategy not attacking with card 1 or 2"); } }
public void ShouldMaximizeDamageOutputInCurrentTurnTest() { IEnumerable <Card> cards = new[] { new Card(7), new Card(6), new Card(4), new Card(3), new Card(2), }; Move move = strategy.NextMove(8, 30, cards); if (move.Card.Value == 2 || move.Card.Value == 6) { Assert.Pass(); } else { Assert.Fail("Strategy not attacking with card 2 or 6"); } }
public void TestBuildEntityViewComponentWithWrongImplementors() { void CheckFunction() { _entityFactory.BuildEntity <TestDescriptorWrongEntityViewInterface>(new EGID(1, group1), new[] { new TestIt(2) }); _simpleSubmissionEntityViewScheduler.SubmitEntities(); } try { CheckFunction(); } catch { Assert.Pass(); return; } Assert.Fail(); }