public void RandomItems_LessThanMax(int itemCount, int listCount) { var sut = new FakeFactory(); var list = new List<string>(); for (int i = 0; i < listCount; i++) list.Add(sut.Word); var items = list.RandomItems(itemCount); Assert.Equal(itemCount, items.Count()); Assert.True(items.IsAllUnique()); }
public UserInfoResponseLinksCreatorTests() { FakeFactory.Create(out _hyperlinkFactory); _sut = new UserInfoResponseLinksCreator(_hyperlinkFactory); }
public ReportsApplicationInfoFilterTests() { FakeFactory.Create(out _applicationInfoProvider); _sut = new ReportsApplicationInfoAttribute.ReportsApplicationInfoFilter(_applicationInfoProvider); }
public void SetUp() { FakeFactory.Init(); }
private FakeHttpContext CreateFakeHttpContextWithoutTheCookie() { return(FakeFactory.FakeHttpContext()); }
public HyperlinkFactoryTests() { FakeFactory.Create(out _applicationUriResolver); _sut = new HyperlinkFactory(_applicationUriResolver); }
public KnownAlgorithmVerificationTaskTests() { FakeFactory.Create(out _logger); _sut = new KnownAlgorithmVerificationTask(_logger); }
public ReturnOnlyRightElementsTestFixture() { FakeFactory.Init(); }
public ApiHomeResponseLinksCreatorTests() { FakeFactory.Create(out _hyperlinkFactory); _sut = new ApiHomeResponseLinksCreator(_hyperlinkFactory); }
public DefaultControllerTests() { FakeFactory.Create(out _applicationInfoProvider, out _apiHomeResponseLinksCreatorFactory); _sut = new DefaultController(_applicationInfoProvider, _apiHomeResponseLinksCreatorFactory); }
public SignatureSanitizerTests() { FakeFactory.Create(out _defaultSignatureHeadersProvider); _sut = new SignatureSanitizer(_defaultSignatureHeadersProvider); }
public SigningTests(ITestOutputHelper testOutputHelper) { this.output = testOutputHelper; this.factory = new FakeFactory(testOutputHelper); this.fee = Money.Coins(0.00023500m * 2); }
public ClaimLinksCreatorTests() { FakeFactory.Create(out _hyperlinkFactory); _sut = new ClaimLinksCreator(_hyperlinkFactory); }
public InvokeUIAControlContextMenuCommandTestFixture() { FakeFactory.Init(); }
public DigestVerificationTaskTests() { FakeFactory.Create(out _logger); _base64Converter = new Base64Converter(); _sut = new DigestVerificationTask(_base64Converter, _logger); }
public FakeViewModel() { var fke = new FakeFactory(); FirstName = fke.Word; LastName = fke.Word; }
public SearchByContainsTextViaWin32TestFixture_less_useful() { FakeFactory.Init(); }
public ISupportsInvokePatternTestFixture() { FakeFactory.Init(); }
private void TestParametersAgainstCollection( ControlType controlType, string name, string automationId, string className, string txtValue, IEnumerable <IUiElement> collection, UsualWildcardRegex selector, int expectedNumberOfElements) { // Arrange ControlType[] controlTypes = new[] { controlType }; GetControlCmdletBase cmdlet = FakeFactory.Get_GetControlCmdletBase(controlTypes, name, automationId, className, txtValue); var data = new ControlSearcherData { ControlType = controlTypes.ConvertControlTypeToStringArray(), Name = name, AutomationId = automationId, Class = className, Value = txtValue }; Condition condition; bool useWildcardOrRegex = true; switch (selector) { case UsualWildcardRegex.Wildcard: condition = ControlSearcher.GetWildcardSearchCondition( data); useWildcardOrRegex = true; break; case UsualWildcardRegex.Regex: condition = ControlSearcher.GetWildcardSearchCondition( data); useWildcardOrRegex = false; break; } // Act var resultList = RealCodeCaller.GetResultList_ReturnOnlyRightElements(collection.ToArray(), data, useWildcardOrRegex); // Assert MbUnit.Framework.Assert.Count(expectedNumberOfElements, resultList); Assert.Equal(expectedNumberOfElements, resultList.Count); string[] controlTypeNames; switch (selector) { case UsualWildcardRegex.Wildcard: const WildcardOptions options = WildcardOptions.IgnoreCase; // 20140312 // WildcardPattern namePattern = new WildcardPattern(name, options); // WildcardPattern automationIdPattern = new WildcardPattern(automationId, options); // WildcardPattern classNamePattern = new WildcardPattern(className, options); // WildcardPattern txtValuePattern = new WildcardPattern(txtValue, options); var namePattern = new WildcardPattern(name, options); var automationIdPattern = new WildcardPattern(automationId, options); var classNamePattern = new WildcardPattern(className, options); var txtValuePattern = new WildcardPattern(txtValue, options); // 20140312 // if (!string.IsNullOrEmpty(name)) { // MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => namePattern.IsMatch(x.Current.Name)); // resultList.All(x => namePattern.IsMatch(x.Current.Name)); // } // if (!string.IsNullOrEmpty(automationId)) { // MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => automationIdPattern.IsMatch(x.Current.AutomationId)); // resultList.All(x => automationIdPattern.IsMatch(x.Current.AutomationId)); // } // if (!string.IsNullOrEmpty(className)) { // MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => classNamePattern.IsMatch(x.Current.ClassName)); // resultList.All(x => classNamePattern.IsMatch(x.Current.ClassName)); // } // controlTypeNames = // controlTypes.Select(ct => null != ct ? ct.ProgrammaticName.Substring(12) : string.Empty).ToArray(); // if (null != controlType) { // MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => controlTypeNames.Contains(x.Current.ControlType.ProgrammaticName.Substring(12))); // resultList.All(x => controlTypeNames.Contains(x.Current.ControlType.ProgrammaticName.Substring(12))); // } if (!string.IsNullOrEmpty(name)) { MbUnit.Framework.Assert.ForAll(resultList.Cast <IUiElement>().ToList <IUiElement>(), x => namePattern.IsMatch(x.GetCurrent().Name)); resultList.All(x => namePattern.IsMatch(x.GetCurrent().Name)); } if (!string.IsNullOrEmpty(automationId)) { MbUnit.Framework.Assert.ForAll(resultList.Cast <IUiElement>().ToList <IUiElement>(), x => automationIdPattern.IsMatch(x.GetCurrent().AutomationId)); resultList.All(x => automationIdPattern.IsMatch(x.GetCurrent().AutomationId)); } if (!string.IsNullOrEmpty(className)) { MbUnit.Framework.Assert.ForAll(resultList.Cast <IUiElement>().ToList <IUiElement>(), x => classNamePattern.IsMatch(x.GetCurrent().ClassName)); resultList.All(x => classNamePattern.IsMatch(x.GetCurrent().ClassName)); } controlTypeNames = controlTypes.Select(ct => null != ct ? ct.ProgrammaticName.Substring(12) : string.Empty).ToArray(); if (null != controlType) { MbUnit.Framework.Assert.ForAll(resultList.Cast <IUiElement>().ToList <IUiElement>(), x => controlTypeNames.Contains(x.GetCurrent().ControlType.ProgrammaticName.Substring(12))); resultList.All(x => controlTypeNames.Contains(x.GetCurrent().ControlType.ProgrammaticName.Substring(12))); } if (!string.IsNullOrEmpty(txtValue)) { MbUnit.Framework.Assert.ForAll( resultList .Cast <IUiElement>() .ToList <IUiElement>(), x => { IValuePattern valuePattern = x.GetCurrentPattern <IValuePattern>(ValuePattern.Pattern) as IValuePattern; return(valuePattern != null && txtValuePattern.IsMatch(valuePattern.Current.Value)); }); resultList.All( x => { IValuePattern valuePattern = x.GetCurrentPattern <IValuePattern>(ValuePattern.Pattern) as IValuePattern; return(valuePattern != null && txtValuePattern.IsMatch(valuePattern.Current.Value)); }); } break; case UsualWildcardRegex.Regex: // 20140312 // if (!string.IsNullOrEmpty(name)) { // MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => Regex.IsMatch(x.Current.Name, name)); // resultList.All(x => Regex.IsMatch(x.Current.Name, name)); // } // if (!string.IsNullOrEmpty(automationId)) { // MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => Regex.IsMatch(x.Current.AutomationId, automationId)); // resultList.All(x => Regex.IsMatch(x.Current.AutomationId, automationId)); // } // if (!string.IsNullOrEmpty(className)) { // MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => Regex.IsMatch(x.Current.ClassName, className)); // resultList.All(x => Regex.IsMatch(x.Current.ClassName, className)); // } // controlTypeNames = // controlTypes.Select(ct => null != ct ? ct.ProgrammaticName.Substring(12) : string.Empty).ToArray(); // if (null != controlType) { // MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => controlTypeNames.Contains(x.Current.ControlType.ProgrammaticName.Substring(12))); // resultList.All(x => controlTypeNames.Contains(x.Current.ControlType.ProgrammaticName.Substring(12))); // } if (!string.IsNullOrEmpty(name)) { MbUnit.Framework.Assert.ForAll(resultList.Cast <IUiElement>().ToList <IUiElement>(), x => Regex.IsMatch(x.GetCurrent().Name, name)); resultList.All(x => Regex.IsMatch(x.GetCurrent().Name, name)); } if (!string.IsNullOrEmpty(automationId)) { MbUnit.Framework.Assert.ForAll(resultList.Cast <IUiElement>().ToList <IUiElement>(), x => Regex.IsMatch(x.GetCurrent().AutomationId, automationId)); resultList.All(x => Regex.IsMatch(x.GetCurrent().AutomationId, automationId)); } if (!string.IsNullOrEmpty(className)) { MbUnit.Framework.Assert.ForAll(resultList.Cast <IUiElement>().ToList <IUiElement>(), x => Regex.IsMatch(x.GetCurrent().ClassName, className)); resultList.All(x => Regex.IsMatch(x.GetCurrent().ClassName, className)); } controlTypeNames = controlTypes.Select(ct => null != ct ? ct.ProgrammaticName.Substring(12) : string.Empty).ToArray(); if (null != controlType) { MbUnit.Framework.Assert.ForAll(resultList.Cast <IUiElement>().ToList <IUiElement>(), x => controlTypeNames.Contains(x.GetCurrent().ControlType.ProgrammaticName.Substring(12))); resultList.All(x => controlTypeNames.Contains(x.GetCurrent().ControlType.ProgrammaticName.Substring(12))); } if (!string.IsNullOrEmpty(txtValue)) { MbUnit.Framework.Assert.ForAll( resultList .Cast <IUiElement>() .ToList <IUiElement>(), x => { IValuePattern valuePattern = x.GetCurrentPattern <IValuePattern>(ValuePattern.Pattern) as IValuePattern; return(valuePattern != null && Regex.IsMatch(valuePattern.Current.Value, txtValue)); }); Assert.True( resultList.All( x => { IValuePattern valuePattern = x.GetCurrentPattern <IValuePattern>(ValuePattern.Pattern) as IValuePattern; return(valuePattern != null && Regex.IsMatch(valuePattern.Current.Value, txtValue)); }) ); } break; } }
public DigestSignatureHeaderEnsurerTests() { FakeFactory.Create(out _base64Converter); _sut = new DigestSignatureHeaderEnsurer(_base64Converter); }
public NoncesFileManagerTests() { FakeFactory.Create(out _fileReader, out _fileWriter, out _dataRecordSerializer); _filePath = Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".xml"); _sut = new NoncesFileManager(_fileReader, _fileWriter, _filePath, _dataRecordSerializer); }
public ISupportsRangeValuePatternTestFixture() { FakeFactory.Init(); }
public GetSupportedPatternsTestFixture() { FakeFactory.Init(); }
public CreationTimeVerificationTaskTests() { FakeFactory.Create(out _systemClock); _sut = new CreationTimeVerificationTask(_systemClock); }
public ISupportsSelectionPatternTestFixture() { FakeFactory.Init(); }
public GetWindowCollectionByPidTestFixture() { FakeFactory.Init(); }
public void Given_New_Poco_When_Add_Then_Poco_Is_Saved_As_Expected() { var repository = new Repository <IPogo>(base.Session); repository.Add(FakeFactory.CreateFakePogo()); }
private void TestParametersAgainstCollection( IEnumerable <int> processIds, IEnumerable <string> names, string automationId, string className, IEnumerable <IUiElement> collection, int expectedNumberOfElements) { // Arrange IUiElement rootElement = FakeFactory.GetElement_ForFindAll( collection, null); var windowSearcherData = new WindowSearcherData { ProcessIds = processIds.ToArray(), Name = new[] { string.Empty }, AutomationId = automationId, Class = className, First = false, Recurse = false }; // Act List <IUiElement> resultList = RealCodeCaller.GetResultList_GetWindowCollectionByPid( rootElement, windowSearcherData); // Assert MbUnit.Framework.Assert.Count(expectedNumberOfElements, resultList); Assert.Equal(expectedNumberOfElements, resultList.Count); // string[] controlTypeNames; // switch (selector) { // case UIAutomationUnitTests.Helpers.Inheritance.UsualWildcardRegex.Wildcard: // const WildcardOptions options = WildcardOptions.IgnoreCase; // WildcardPattern namePattern = new WildcardPattern(name, options); // WildcardPattern automationIdPattern = new WildcardPattern(automationId, options); // WildcardPattern classNamePattern = new WildcardPattern(className, options); // WildcardPattern txtValuePattern = new WildcardPattern(txtValue, options); // // if (!string.IsNullOrEmpty(name)) { // MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => namePattern.IsMatch(x.Current.Name)); // resultList.All(x => namePattern.IsMatch(x.Current.Name)); // } // if (!string.IsNullOrEmpty(automationId)) { // MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => automationIdPattern.IsMatch(x.Current.AutomationId)); // resultList.All(x => automationIdPattern.IsMatch(x.Current.AutomationId)); // } // if (!string.IsNullOrEmpty(className)) { // MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => classNamePattern.IsMatch(x.Current.ClassName)); // resultList.All(x => classNamePattern.IsMatch(x.Current.ClassName)); // } // controlTypeNames = // controlTypes.Select(ct => null != ct ? ct.ProgrammaticName.Substring(12) : string.Empty).ToArray(); // if (null != controlType) { // MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => controlTypeNames.Contains(x.Current.ControlType.ProgrammaticName.Substring(12))); // resultList.All(x => controlTypeNames.Contains(x.Current.ControlType.ProgrammaticName.Substring(12))); // } // // if (!string.IsNullOrEmpty(txtValue)) { // MbUnit.Framework.Assert.ForAll( // resultList // .Cast<IUiElement>() // .ToList<IUiElement>(), x => // { // IValuePattern valuePattern = x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern; // return valuePattern != null && txtValuePattern.IsMatch(valuePattern.Current.Value); // }); // // resultList.All( // x => { // IValuePattern valuePattern = x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern; // return valuePattern != null && txtValuePattern.IsMatch(valuePattern.Current.Value); // }); // } // break; // case UIAutomationUnitTests.Helpers.Inheritance.UsualWildcardRegex.Regex: // if (!string.IsNullOrEmpty(name)) { // MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => Regex.IsMatch(x.Current.Name, name)); // resultList.All(x => Regex.IsMatch(x.Current.Name, name)); // } // if (!string.IsNullOrEmpty(automationId)) { // MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => Regex.IsMatch(x.Current.AutomationId, automationId)); // resultList.All(x => Regex.IsMatch(x.Current.AutomationId, automationId)); // } // if (!string.IsNullOrEmpty(className)) { // MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => Regex.IsMatch(x.Current.ClassName, className)); // resultList.All(x => Regex.IsMatch(x.Current.ClassName, className)); // } // controlTypeNames = // controlTypes.Select(ct => null != ct ? ct.ProgrammaticName.Substring(12) : string.Empty).ToArray(); // if (null != controlType) { // MbUnit.Framework.Assert.ForAll(resultList.Cast<IUiElement>().ToList<IUiElement>(), x => controlTypeNames.Contains(x.Current.ControlType.ProgrammaticName.Substring(12))); // resultList.All(x => controlTypeNames.Contains(x.Current.ControlType.ProgrammaticName.Substring(12))); // } // if (!string.IsNullOrEmpty(txtValue)) { // MbUnit.Framework.Assert.ForAll( // resultList // .Cast<IUiElement>() // .ToList<IUiElement>(), x => // { // IValuePattern valuePattern = x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern; // return valuePattern != null && Regex.IsMatch(valuePattern.Current.Value, txtValue); // }); // Xunit.Assert.True( // resultList.All( // x => { // IValuePattern valuePattern = x.GetCurrentPattern<IValuePattern>(ValuePattern.Pattern) as IValuePattern; // return valuePattern != null && Regex.IsMatch(valuePattern.Current.Value, txtValue); // }) // ); // } // break; // } }
public CompositeSignatureHeaderEnsurerTests() { FakeFactory.Create(out _dateHeaderEnsurer, out _digestHeaderEnsurer); _sut = new CompositeSignatureHeaderEnsurer(_dateHeaderEnsurer, _digestHeaderEnsurer); }
public WaitUIAControlStateCommandTestFixture() { FakeFactory.Init(); }
public ISupportsTableItemPatternTestFixture() { FakeFactory.Init(); }
public ISupportsTextPatternTestFixture() { FakeFactory.Init(); }