Here are the examples of the csharp api Xunit.Assert.NotEmpty(System.Collections.IEnumerable) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
178 Examples
19
Source : SymmetricKeyTokenVerification.cs
with Apache License 2.0
from aspnet
with Apache License 2.0
from aspnet
[Fact, Trait("FunctionalTests", "Security")]
public void Security_SymmetricKeyTokenVerificationFact()
{
var issuer = "http://katanatesting.com/";
var sentIdenreplacedy = new ClaimsIdenreplacedy("CustomJwt", "MyNameClaimType", "MyRoleClaimType");
sentIdenreplacedy.AddClaims(new Claim[] { new Claim("MyNameClaimType", "TestUser"), new Claim("MyRoleClaimType", "Administrator") });
for (int i = 0; i < 5; i++)
{
sentIdenreplacedy.AddClaim(new Claim("ClaimId" + i.ToString(), i.ToString()));
}
var authProperties = new AuthenticationProperties();
var sentTicket = new AuthenticationTicket(sentIdenreplacedy, authProperties);
var signingAlgorithm = new AesManaged();
var signingCredentials = new SigningCredentials(new SymmetricSecurityKey(signingAlgorithm.Key), SecurityAlgorithms.HmacSha256Signature, SecurityAlgorithms.Sha256Digest);
var tokenValidationParameters = new TokenValidationParameters() { ValidAudience = issuer, SaveSigninToken = true, AuthenticationType = sentIdenreplacedy.AuthenticationType };
var formatter = new JwtFormat(tokenValidationParameters, new SymmetricKeyIssuerSecurityKeyProvider(issuer, signingAlgorithm.Key));
formatter.TokenHandler = new JwtSecurityTokenHandler();
var protectedtext = SecurityUtils.CreateJwtToken(sentTicket, issuer, signingCredentials);
//Receive part
var receivedTicket = formatter.Unprotect(protectedtext);
var receivedClaims = receivedTicket.Idenreplacedy.Claims;
replacedert.Equal<string>("CustomJwt", receivedTicket.Idenreplacedy.AuthenticationType);
replacedert.Equal<string>(ClaimsIdenreplacedy.DefaultNameClaimType, receivedTicket.Idenreplacedy.NameClaimType);
replacedert.Equal<string>(ClaimsIdenreplacedy.DefaultRoleClaimType, receivedTicket.Idenreplacedy.RoleClaimType);
replacedert.NotNull(receivedTicket.Idenreplacedy.BootstrapContext);
replacedert.NotNull((receivedTicket.Idenreplacedy.BootstrapContext) as string);
replacedert.Equal<string>(issuer, receivedClaims.Where<Claim>(claim => claim.Type == "iss").FirstOrDefault().Value);
replacedert.Equal<string>(issuer, receivedClaims.Where<Claim>(claim => claim.Type == "aud").FirstOrDefault().Value);
replacedert.NotEmpty(receivedClaims.Where<Claim>(claim => claim.Type == "exp").FirstOrDefault().Value);
for (int i = 0; i < 5; i++)
{
sentIdenreplacedy.AddClaim(new Claim("ClaimId" + i.ToString(), i.ToString()));
replacedert.Equal<string>(i.ToString(), receivedClaims.Where<Claim>(claim => claim.Type == "ClaimId" + i.ToString()).FirstOrDefault().Value);
}
replacedert.Equal<string>("TestUser", receivedClaims.Where<Claim>(claim => claim.Type == ClaimsIdenreplacedy.DefaultNameClaimType).FirstOrDefault().Value);
replacedert.Equal<string>("Administrator", receivedClaims.Where<Claim>(claim => claim.Type == ClaimsIdenreplacedy.DefaultRoleClaimType).FirstOrDefault().Value);
replacedert.NotEmpty(receivedClaims.Where<Claim>(claim => claim.Type == "iat").FirstOrDefault().Value);
replacedert.NotEmpty(receivedClaims.Where<Claim>(claim => claim.Type == "jti").FirstOrDefault().Value);
}
19
Source : AjaxRequest.cs
with Apache License 2.0
from aspnet
with Apache License 2.0
from aspnet
[Theory, Trait("FunctionalTests", "Security")]
[InlineData(HostType.IIS)]
[InlineData(HostType.HttpListener)]
public void Security_AjaxUnAuthorizedResponses(HostType hostType)
{
using (ApplicationDeployer deployer = new ApplicationDeployer())
{
string applicationUrl = deployer.Deploy(hostType, SimulateAjaxRequestConfiguration);
var httpClient = new HttpClient();
//Simulate an AJAX request
httpClient.DefaultRequestHeaders.Add("X-Requested-With", "XMLHttpRequest");
var response = httpClient.GetAsync(applicationUrl).Result;
//For AJAX requests the cookie middleware should not send a 302 on a 401 response.
//Instead it should send a response back with this below header and a dictionary having the redirect location information
replacedert.NotEmpty(string.Join(",", response.Headers.GetValues("X-Responded-JSON")));
var ajaxResponseObject = JsonConvert.DeserializeObject<AjaxResponse>(string.Join(",", response.Headers.GetValues("X-Responded-JSON")));
replacedert.Equal<int>(401, ajaxResponseObject.status);
replacedert.Equal<int>(1, ajaxResponseObject.headers.Count);
replacedert.True(new Uri(ajaxResponseObject.headers["location"]).AbsolutePath.EndsWith("/Auth/CookiesLogin"));
replacedert.Equal<string>(new Uri(ajaxResponseObject.headers["location"]).ParseQueryString()["ReturnUrl"], new Uri(applicationUrl).AbsolutePath);
}
}
19
Source : ContainerTestsBase.cs
with Apache License 2.0
from aspnet
with Apache License 2.0
from aspnet
[Fact]
public void MultipleLoadersCanBeRegistered()
{
Func<Type, object> container = CreateContainer();
IList<string> errors = new List<string>();
var loaderChain = (IAppLoader)container(typeof(IAppLoader));
loaderChain.Load("Hello", errors).ShouldBe(TestAppLoader1.Result);
loaderChain.Load("World", errors).ShouldBe(TestAppLoader2.Result);
replacedert.NotEmpty(errors);
errors.Clear();
loaderChain.Load("!", errors).ShouldBe(null);
replacedert.NotEmpty(errors);
}
19
Source : DefaultWebHookIdValidatorTests.cs
with Apache License 2.0
from aspnet
with Apache License 2.0
from aspnet
[Theory]
[InlineData("a")]
[InlineData("12345")]
[InlineData("你好世界")]
public async Task ValidateIfAsync_ForcesDefaultId(string id)
{
// Arrange
WebHook webHook = new WebHook { Id = id };
// Act
await _validator.ValidateIdAsync(_request, webHook);
// replacedert
replacedert.NotEmpty(webHook.Id);
replacedert.NotEqual(id, webHook.Id);
}
19
Source : DefaultConfigurationLoaderTests.cs
with Apache License 2.0
from aspnet
with Apache License 2.0
from aspnet
[Fact]
public void An_extra_segment_will_cause_the_match_to_fail()
{
var loader = new DefaultLoader();
IList<string> errors = new List<string>();
Action<IAppBuilder> configuration = loader.Load("Owin.Loader.Tests.DefaultConfigurationLoaderTests.Hello.Bar", errors);
replacedert.Null(configuration);
replacedert.NotEmpty(errors);
}
19
Source : TestAssert.cs
with Apache License 2.0
from aspnet
with Apache License 2.0
from aspnet
internal static IEnumerable<IHtmlElement> HasElements(string selector, IHtmlDoreplacedent doreplacedent)
{
var elements = doreplacedent
.QuerySelectorAll(selector)
.OfType<IHtmlElement>()
.ToArray();
replacedert.NotEmpty(elements);
return elements;
}
19
Source : PropertyAssert.cs
with Apache License 2.0
from aspnet
with Apache License 2.0
from aspnet
public static void PublicPropertiesAreSet<TInstance>(TInstance instance, IEnumerable<string> excludeProperties = null)
where TInstance : clreplaced
{
PropertyInfo[] properties = typeof(TInstance).GetProperties();
foreach (PropertyInfo p in properties)
{
if (excludeProperties != null && excludeProperties.Contains(p.Name, StringComparer.OrdinalIgnoreCase))
{
continue;
}
if (p.CanWrite)
{
MethodInfo isSet = _isSetMethod.MakeGenericMethod(p.PropertyType);
bool result = (bool)isSet.Invoke(instance, new object[] { p.GetValue(instance) });
replacedert.True(result, string.Format("Parameter '{0}' was not set on type '{1}'", p.Name, typeof(TInstance).Name));
}
else if (typeof(IEnumerable).IsreplacedignableFrom(p.PropertyType))
{
replacedert.NotEmpty((IEnumerable)p.GetValue(instance));
}
}
}
19
Source : MSBuildProjectManagerTest.cs
with Apache License 2.0
from aspnet
with Apache License 2.0
from aspnet
[Fact]
public void TryResolveConfigurationOutputPath_RelativeIntermediateOutputPath_ReturnsTrue()
{
// Arrange
var projectRootElement = ProjectRootElement.Create();
var intermediateOutputPath = "obj";
projectRootElement.AddProperty(MSBuildProjectManager.IntermediateOutputPathPropertyName, intermediateOutputPath);
// Project directory is automatically set to the current test project (it's a reserved MSBuild property).
var projectInstance = new ProjectInstance(projectRootElement);
var expectedPath = Path.Combine(intermediateOutputPath, MSBuildProjectManager.RazorConfigurationFileName);
// Act
var result = MSBuildProjectManager.TryResolveConfigurationOutputPath(projectInstance, out var path);
// replacedert
replacedert.True(result);
replacedert.NotEmpty(path);
}
19
Source : CatalogServiceTests.cs
with MIT License
from dotnet-architecture
with MIT License
from dotnet-architecture
[Fact]
public async Task GetFakeCatalogBrandTest()
{
var catalogMockService = new CatalogMockService();
var catalogBrand = await catalogMockService.GetCatalogBrandAsync();
replacedert.NotEmpty(catalogBrand);
}
19
Source : MockViewModelTests.cs
with MIT License
from dotnet-architecture
with MIT License
from dotnet-architecture
[Fact]
public void CheckValidationFailsWhenPropertiesAreEmptyTest()
{
var mockViewModel = new MockViewModel();
bool isValid = mockViewModel.Validate();
replacedert.False(isValid);
replacedert.Null(mockViewModel.Forename.Value);
replacedert.Null(mockViewModel.Surname.Value);
replacedert.False(mockViewModel.Forename.IsValid);
replacedert.False(mockViewModel.Surname.IsValid);
replacedert.NotEmpty(mockViewModel.Forename.Errors);
replacedert.NotEmpty(mockViewModel.Surname.Errors);
}
19
Source : MockViewModelTests.cs
with MIT License
from dotnet-architecture
with MIT License
from dotnet-architecture
[Fact]
public void CheckValidationPreplacedesWhenOnlySurnameHasDataTest()
{
var mockViewModel = new MockViewModel();
mockViewModel.Surname.Value = "Smith";
bool isValid = mockViewModel.Validate();
replacedert.False(isValid);
replacedert.Null(mockViewModel.Forename.Value);
replacedert.NotNull(mockViewModel.Surname.Value);
replacedert.False(mockViewModel.Forename.IsValid);
replacedert.True(mockViewModel.Surname.IsValid);
replacedert.NotEmpty(mockViewModel.Forename.Errors);
replacedert.Empty(mockViewModel.Surname.Errors);
}
19
Source : BasketServiceTests.cs
with MIT License
from dotnet-architecture
with MIT License
from dotnet-architecture
[Fact]
public async Task GetFakeBasketTest()
{
var catalogMockService = new CatalogMockService();
var result = await catalogMockService.GetCatalogAsync();
replacedert.NotEmpty(result);
}
19
Source : CatalogServiceTests.cs
with MIT License
from dotnet-architecture
with MIT License
from dotnet-architecture
[Fact]
public async Task GetFakeCatalogTest()
{
var catalogMockService = new CatalogMockService();
var catalog = await catalogMockService.GetCatalogAsync();
replacedert.NotEmpty(catalog);
}
19
Source : CatalogServiceTests.cs
with MIT License
from dotnet-architecture
with MIT License
from dotnet-architecture
[Fact]
public async Task GetFakeCatalogTypeTest()
{
var catalogMockService = new CatalogMockService();
var catalogType = await catalogMockService.GetCatalogTypeAsync();
replacedert.NotEmpty(catalogType);
}
19
Source : MarketingServiceTests.cs
with MIT License
from dotnet-architecture
with MIT License
from dotnet-architecture
[Fact]
public async Task GetFakeCampaignsTest()
{
var campaignMockService = new CampaignMockService();
var result = await campaignMockService.GetAllCampaignsAsync(GlobalSetting.Instance.AuthToken);
replacedert.NotEmpty(result);
}
19
Source : OrdersServiceTests.cs
with MIT License
from dotnet-architecture
with MIT License
from dotnet-architecture
[Fact]
public async Task GetFakeOrdersTest()
{
var ordersMockService = new OrderMockService();
var result = await ordersMockService.GetOrdersAsync(GlobalSetting.Instance.AuthToken);
replacedert.NotEmpty(result);
}
19
Source : MockViewModelTests.cs
with MIT License
from dotnet-architecture
with MIT License
from dotnet-architecture
[Fact]
public void CheckValidationFailsWhenOnlyForenameHasDataTest()
{
var mockViewModel = new MockViewModel();
mockViewModel.Forename.Value = "John";
bool isValid = mockViewModel.Validate();
replacedert.False(isValid);
replacedert.NotNull(mockViewModel.Forename.Value);
replacedert.Null(mockViewModel.Surname.Value);
replacedert.True(mockViewModel.Forename.IsValid);
replacedert.False(mockViewModel.Surname.IsValid);
replacedert.Empty(mockViewModel.Forename.Errors);
replacedert.NotEmpty(mockViewModel.Surname.Errors);
}
19
Source : EventFilterWith3Topics.cs
with MIT License
from dragonglasscom
with MIT License
from dragonglasscom
[Fact]
public async Task Test()
{
var web3 = _ethereumClientIntegrationFixture.GetWeb3();
var addressFrom = AccountFactory.Address;
var receipt = await web3.Eth.GetContractDeploymentHandler<TestEventDeployment>()
.SendRequestAndWaitForReceiptAsync(new TestEventDeployment(){FromAddress = addressFrom});
var contractHandler = web3.Eth.GetContractHandler(receipt.ContractAddress);
var bytes = "0x3031303230333034000000000000000000000000000000000000000000000000".HexToByteArray();
//Event with all parameters fixed 32 bytes 2 addresses indexed and last indexed bytes 32
var eventAllBytes32 = contractHandler.GetEvent<PushedResultEventDTO>();
var filterAllBytes32 = await eventAllBytes32.CreateFilterAsync(addressFrom, addressFrom, bytes,
new BlockParameter(receipt.BlockNumber), BlockParameter.CreateLatest());
//Event with dynamic and last indexed bytes32
var eventPushed = contractHandler.GetEvent<PushedEventDTO>();
//ERROR creating filter
//var filter2 = await eventPushed.CreateFilterAsync(addressFrom, addressFrom, bytes,
// new BlockParameter(receipt.BlockNumber), BlockParameter.CreateLatest());
//Event with dynamic bytes all indexed values at the front
var eventIndexedAtTheFront = contractHandler.GetEvent<Pushed2EventDTO>();
var filterIndexedAtTheFront = await eventIndexedAtTheFront.CreateFilterAsync(addressFrom, addressFrom, bytes,
new BlockParameter(receipt.BlockNumber), BlockParameter.CreateLatest());
var pushReceipt = await contractHandler.SendRequestAndWaitForReceiptAsync(new PushEventFunction(){FromAddress = addressFrom});
// Getting changes from the event with all bytes32
var filterChangesAllBytes32 = await eventAllBytes32.GetFilterChanges<PushedResultEventDTO>(filterAllBytes32);
replacedert.NotEmpty(filterChangesAllBytes32);
replacedert.Equal(addressFrom.ToLower(), filterChangesAllBytes32[0].Event.First.ToLower());
//Decoding the event (that we cannot create a filter) from the transaction receipt
var eventsPushed = eventPushed.DecodeAllEventsForEvent<PushedEventDTO>(pushReceipt.Logs);
replacedert.NotEmpty(eventsPushed);
replacedert.Equal(addressFrom.ToLower(), eventsPushed[0].Event.First.ToLower());
// Getting changes from the event with indexed at the front
var filterChangesIndexedAtTheFront = await eventIndexedAtTheFront.GetFilterChanges<PushedResultEventDTO>(filterIndexedAtTheFront);
replacedert.NotEmpty(filterChangesIndexedAtTheFront);
replacedert.Equal(addressFrom.ToLower(), filterChangesIndexedAtTheFront[0].Event.First.ToLower());
}
19
Source : AccountServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void AddAddress_IfManagersResultSuccess_ShouldReturnSuccessResult()
{
// act
var userName = this.fixture.Create<string>();
var address = this.fixture.Create<Address>();
var addPartiesResult = this.InitAddAddress(userName);
// replacedert
var result = this.service.AddAddress(userName, address);
// replacedert
replacedert.True(result.Success);
replacedert.Empty(result.Errors);
replacedert.NotEmpty(result.Data);
this.mapper.Received(1).Map<Address, CommerceParty>(address);
this.mapper.Received(addPartiesResult.Parties.Count).Map<Party, Address>(Arg.Any<Party>());
}
19
Source : SafePipelineProcessorTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void
Process_IfSafeProcessThrowsException_ShouldWriteExceptionToLogNotThrowExceptionAddMessageToArgsAbortPipeline()
{
// arrange
var processor = new ThrowsExceptionProcessor(this.logService);
var args = new PipelineArgs();
// act
var exception = Record.Exception(() => processor.Process(args));
// replacedert
replacedert.Null(exception);
this.logService.Received(1).Error(Arg.Any<string>());
replacedert.True(args.Aborted);
replacedert.NotEmpty(args.GetMessages(PipelineMessageFilter.Errors));
}
19
Source : AccountServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void GetAddresses_IfUserResultFail_ShouldReturnFailResult()
{
// arrange
var userName = this.fixture.Create<string>();
this.InitGetAddresses(userName, false);
// act
var result = this.service.GetAddresses(userName);
// replacedert
replacedert.False(result.Success);
replacedert.NotEmpty(result.Errors);
}
19
Source : AccountServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void GetAddresses_IfGetPartiesResultFail_ShouldReturnFailResult()
{
// act
var userName = this.fixture.Create<string>();
this.InitGetAddresses(userName, true, false);
// replacedert
var result = this.service.GetAddresses(userName);
// replacedert
replacedert.False(result.Success);
replacedert.NotEmpty(result.Errors);
}
19
Source : AccountServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void GetAddresses_IfManagersResultSuccess_ShouldReturnSuccessResult()
{
// act
var userName = this.fixture.Create<string>();
var getPartiesResult = this.InitGetAddresses(userName);
// replacedert
var result = this.service.GetAddresses(userName);
// replacedert
replacedert.True(result.Success);
replacedert.Empty(result.Errors);
replacedert.NotEmpty(result.Data);
this.mapper.Received(getPartiesResult.Parties.Count).Map<Party, Address>(Arg.Any<Party>());
}
19
Source : AccountServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void RemoveAddress_IfRemovePartiesResultFail_ShouldReturnFailResult()
{
// act
var userName = this.fixture.Create<string>();
var externalId = this.fixture.Create<string>();
this.InitRemoveAddress(userName, false);
// replacedert
var result = this.service.RemoveAddress(userName, externalId);
// replacedert
replacedert.False(result.Success);
replacedert.NotEmpty(result.Errors);
}
19
Source : DeliveryServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void GetShippingInfo_ShouldGetShippingMethods()
{
// arrange
this.ArrangeGetShippingInfo();
// act
var result = this.deliveryService.GetShippingInfo();
// replacedert
this.shippingManager.Received(1).GetShippingMethods(Arg.Any<Cart>(), Arg.Any<ShippingOptionType>());
this.shippingMapper.Received(1)
.Map<IReadOnlyCollection<Sitecore.Commerce.Enreplacedies.Shipping.ShippingMethod>, List<ShippingMethod>>(
Arg.Any<ReadOnlyCollection<Sitecore.Commerce.Enreplacedies.Shipping.ShippingMethod>>());
replacedert.NotEmpty(result.Data.ShippingMethods);
}
19
Source : DeliveryServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void GetShippingInfo_ShouldMapShippingMethods()
{
// arrange
this.ArrangeGetShippingInfo(true);
// act
var result = this.deliveryService.GetShippingInfo();
// replacedert
replacedert.NotEmpty(result.Errors);
}
19
Source : SearchOptionsBuilderTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void Build_ShouldSetSearchSettingsAndSearchOptionsFacetIntersectionByNameToFacets()
{
//arrange
var commonFacet = this.fixture.Create<Connect.Facet>();
var searchSettings = this.fixture.Create<Connect.SearchSettings>();
searchSettings.Facets = this.ArrangeSearchSettingsFacets(commonFacet.Name, commonFacet.DisplayName);
var productSearchOptions = this.fixture.Create<ProductSearchOptions>();
productSearchOptions.SortField = searchSettings.SortFieldNames?.FirstOrDefault();
productSearchOptions.Facets = this.ArrangeSearchOptionsFacets(commonFacet.Name, commonFacet.Values);
this.searchMapper.Map<IEnumerable<Facet>, IEnumerable<Connect.Facet>>(Arg.Any<IEnumerable<Facet>>())
.Returns(
args =>
{
var facets = args[0] as IEnumerable<Facet>;
return facets?.Select(
facet => new Connect.Facet
{
Name = facet.Name,
DisplayName = facet.DisplayName,
Values = facet.Values
});
});
// act
var searchOptions = this.builder.Build(searchSettings, productSearchOptions);
// replacedert
replacedert.NotNull(searchOptions.Facets);
replacedert.True(searchOptions.Facets.Count() == 1);
replacedert.True(searchOptions.Facets.FirstOrDefault().Name == commonFacet.Name);
replacedert.True(searchOptions.Facets.FirstOrDefault().DisplayName == commonFacet.DisplayName);
replacedert.NotNull(searchOptions.Facets.FirstOrDefault(facet => facet.Name == commonFacet.Name).Values);
replacedert.NotEmpty(searchOptions.Facets.FirstOrDefault(facet => facet.Name == commonFacet.Name).Values);
}
19
Source : AccountServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void UpdateAccount_IfUpdateResultFail_ShouldReturnFailResult()
{
// act
var contactId = this.fixture.Create<string>();
var firstName = this.fixture.Create<string>();
var lastName = this.fixture.Create<string>();
this.InitUpdateAccount(contactId, true, false);
// replacedert
var result = this.service.UpdateAccount(contactId, firstName, lastName);
// replacedert
replacedert.False(result.Success);
replacedert.NotEmpty(result.Errors);
}
19
Source : DeliveryServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void GetShippingInfo_IfLoadCartWasUnsuccessful_ShouldSetErrors()
{
// arrange
this.ArrangeGetShippingInfo();
this.cartResult.Success = false;
this.cartResult.SystemMessages.Add(new SystemMessage("Test message"));
// act
var result = this.deliveryService.GetShippingInfo();
// replacedert
replacedert.NotEmpty(result.Errors);
}
19
Source : AccountServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void AddAddress_IfAddPartiesResultFail_ShouldReturnFailResult()
{
// act
var userName = this.fixture.Create<string>();
var address = this.fixture.Create<Address>();
this.InitAddAddress(userName, false);
// replacedert
var result = this.service.AddAddress(userName, address);
// replacedert
replacedert.False(result.Success);
replacedert.NotEmpty(result.Errors);
}
19
Source : AccountServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void CreateAccount_IfCreateUserResultFail_ShouldReturnFailResult()
{
// act
var email = this.fixture.Create<string>();
var firstName = this.fixture.Create<string>();
var lastName = this.fixture.Create<string>();
var preplacedword = this.fixture.Create<string>();
this.InitCreateAccount(email, preplacedword, false);
// replacedert
var result = this.service.CreateAccount(email, firstName, lastName, preplacedword);
// replacedert
replacedert.False(result.Success);
replacedert.NotEmpty(result.Errors);
}
19
Source : AccountServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Theory]
[InlineData(true)]
[InlineData(false)]
public void CreateAccount_IfUpdateResultFail_ShouldReturnFailResult(bool enableUserResultSuccess)
{
// act
var email = this.fixture.Create<string>();
var firstName = this.fixture.Create<string>();
var lastName = this.fixture.Create<string>();
var preplacedword = this.fixture.Create<string>();
this.InitCreateAccount(email, preplacedword, true, enableUserResultSuccess, false);
// replacedert
var result = this.service.CreateAccount(email, firstName, lastName, preplacedword);
// replacedert
replacedert.False(result.Success);
replacedert.NotEmpty(result.Errors);
}
19
Source : AccountServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void UpdateAccount_IfGetUserResultFail_ShouldReturnFailResult()
{
// act
var contactId = this.fixture.Create<string>();
var firstName = this.fixture.Create<string>();
var lastName = this.fixture.Create<string>();
this.InitUpdateAccount(contactId, false);
// replacedert
var result = this.service.UpdateAccount(contactId, firstName, lastName);
// replacedert
replacedert.False(result.Success);
replacedert.NotEmpty(result.Errors);
}
19
Source : DeliveryServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void GetDeliveryInfo_IfCartIsNotEmpty_ShouldAddShippingOptions()
{
// arrange
this.ArrageGetDeliveryInfo();
// act
var result = this.deliveryService.GetDeliveryInfo();
// replacedert
this.shippingMapper.Received(1)
.Map<IReadOnlyCollection<ShippingOption>, List<Models.Enreplacedies.Shipping.ShippingOption>>(
Arg.Any<ReadOnlyCollection<ShippingOption>>());
replacedert.NotEmpty(result.Data.ShippingOptions);
}
19
Source : DeliveryServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void GetDeliveryInfo_IfCartIsNotEmpty_ShouldAddUserInfo()
{
// arrange
this.ArrageGetDeliveryInfo();
// act
var result = this.deliveryService.GetDeliveryInfo();
// replacedert
replacedert.NotEmpty(result.Data.UserAddresses);
}
19
Source : DeliveryServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void GetDeliveryInfo_IfGetCustomerPartiesWasUnsuccessful_ShouldSetErrors()
{
// arrange
this.ArrageGetDeliveryInfo(isGetCustomerPartiesFailed: true);
// act
var result = this.deliveryService.GetDeliveryInfo();
// replacedert
replacedert.NotEmpty(result.Errors);
}
19
Source : DeliveryServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void GetDeliveryInfo_IfGetShippingOptionsWasUnsuccessful_ShouldSetErrors()
{
// arrange
this.ArrageGetDeliveryInfo(true);
// act
var result = this.deliveryService.GetDeliveryInfo();
// replacedert
replacedert.NotEmpty(result.Errors);
}
19
Source : DeliveryServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void GetDeliveryInfo_IfLoadCartWasUnsuccessful_ShouldSetErrors()
{
// arrange
this.ArrageGetDeliveryInfo();
this.cartResult.Success = false;
this.cartResult.SystemMessages.Add(new SystemMessage("Test message"));
// act
var result = this.deliveryService.GetDeliveryInfo();
// replacedert
replacedert.NotEmpty(result.Errors);
}
19
Source : DeliveryServiceTests.cs
with Apache License 2.0
from epam
with Apache License 2.0
from epam
[Fact]
public void GetShippingInfo_SetShippingOptions_ShouldSetErrors()
{
// arrange
this.ArrangeSetShippingOptions();
this.cartResult.Success = false;
this.cartResult.SystemMessages.Add(new SystemMessage("Test message"));
// act
var result = this.deliveryService.SetShippingOptions(
"testShippingPreferenceType",
new List<Address>(),
new List<ShippingMethod>());
// replacedert
replacedert.NotEmpty(result.Errors);
}
19
Source : ScriptTests.cs
with MIT License
from haven1433
with MIT License
from haven1433
[Fact]
public void LoadPointerCommand_StartsWithWhitespace_StillGetHelp() {
replacedert.NotEmpty(ViewPort.Tools.CodeTool.ScriptParser.GetHelp(" loadpointer"));
}
19
Source : TrainerTeamTests.cs
with MIT License
from haven1433
with MIT License
from haven1433
[Fact]
public void DashSpaceDash_AutoComplete_HaveOptions() {
var options = run.GetAutoCompleteOptions("- -", 3, 3).ToList();
replacedert.NotEmpty(options);
}
19
Source : TrainerTeamTests.cs
with MIT License
from haven1433
with MIT License
from haven1433
[Theory]
[InlineData("-")]
[InlineData("'")]
[InlineData(".")]
public void SpecialCharacterInPokemonName_AutoComplete_ListContainsOnlyElementsWithThatCharacter(string specialCharacter) {
var options = run.GetAutoCompleteOptions("12 " + specialCharacter, 4, 4).ToList();
replacedert.NotEmpty(options);
replacedert.All(options, option => replacedert.Contains(specialCharacter, option.Text));
}
19
Source : TrainerTeamTests.cs
with MIT License
from haven1433
with MIT License
from haven1433
[Theory]
[InlineData("-")]
[InlineData("'")]
public void SpecialCharacterInItemName_AutoComplete_ListContainsOnlyElementsWithThatCharacter(string specialCharacter) {
var options = run.GetAutoCompleteOptions("12 bulbsaur @" + specialCharacter, 14, 14).ToList();
replacedert.NotEmpty(options);
replacedert.All(options, option => replacedert.Contains(specialCharacter, option.Text));
}
19
Source : AutoSearchTests.cs
with MIT License
from haven1433
with MIT License
from haven1433
[SkippableTheory]
[MemberData(nameof(PokemonGames))]
public void Table_Enum_SourceFound(string game) {
var noChange = new NoDataChangeDeltaModel();
var model = fixture.LoadModel(game);
foreach (var anchor in model.Anchors) {
var run = model.GetNextRun(model.GetAddressFromAnchor(noChange, -1, anchor));
if (!(run is ITableRun table)) continue;
for (int i = 0; i < table.ElementContent.Count; i++) {
if (table.ElementContent[i] is ArrayRunBitArraySegment bitArray) {
replacedert.NotEmpty(bitArray.GetOptions(model));
} else if (table.ElementContent[i] is ArrayRunEnumSegment enumSegment) {
replacedert.NotEmpty(enumSegment.GetOptions(model));
}
}
}
}
19
Source : DiffTests.cs
with MIT License
from haven1433
with MIT License
from haven1433
[Fact]
public void DiffTab_HasHeader() {
ViewModel0.Edit("11 ");
ViewModel0.DiffRight.Execute();
replacedert.Empty(ViewModel2.FileName);
replacedert.NotEmpty(ViewModel2.FullFileName);
}
19
Source : ImageTests.cs
with MIT License
from haven1433
with MIT License
from haven1433
[Fact]
public void AutoPaletteFailsIfHighBitsSet() {
ViewPort.Edit("FF FF @20 ^somedata @00 ^pal ");
var items = ViewPort.GetContextMenuItems(new Point(0, 0));
var item = items.Single(element => element.Text == "Display As...");
item = ((ContexreplacedemGroup)item).Single(element => element.Text == "Color Palette");
var makePalette = item.Command;
makePalette.Execute();
replacedert.NotEmpty(Errors);
}
19
Source : StreamTests.cs
with MIT License
from haven1433
with MIT License
from haven1433
[Fact]
public void ExtendingTableStreamRepoints() {
ViewPort.Edit("00 01 02 03 FF ^bob CC @00 ^table[value.]!FF ");
ViewPort.Tools.SelectedIndex = ViewPort.Tools.IndexOf(ViewPort.Tools.StringTool);
replacedert.Equal(@"0
1
2
3", ViewPort.Tools.StringTool.Content);
ViewPort.Tools.StringTool.Content = @"0
1
2
3
4";
replacedert.NotEmpty(Messages);
var anchorAddress = Model.GetAddressFromAnchor(new NoDataChangeDeltaModel(), -1, "table");
replacedert.NotEqual(0, anchorAddress);
}
19
Source : ScriptTests.cs
with MIT License
from haven1433
with MIT License
from haven1433
[Fact]
public void CanCreateXseScriptFromContextMenu() {
Model[0x22] = 0xFF;
ViewPort.Refresh();
ViewPort.SelectionStart = new Point(2, 2);
var group = (ContexreplacedemGroup)ViewPort.GetContextMenuItems(new Point(2, 2)).Single(cmi => cmi.Text == "Create New...");
var item = group.Single(cmi => cmi.Text == "Event Script");
item.Command.Execute();
replacedert.Equal(ViewPort.Tools.CodeTool, ViewPort.Tools.SelectedTool);
replacedert.Equal(CodeMode.Script, ViewPort.Tools.CodeTool.Mode);
replacedert.EndsWith("end", ViewPort.Tools.CodeTool.Contents.Single().Content.Trim());
replacedert.IsType<XSERun>(Model.GetNextRun(0x22));
var anchorName = Model.GetAnchorFromAddress(-1, 0x22);
replacedert.NotEmpty(anchorName);
replacedert.Equal(anchorName, ViewPort.AnchorText.Substring(ViewPort.AnchorTextSelectionStart, ViewPort.AnchorTextSelectionLength));
}
19
Source : StringModelTests.cs
with MIT License
from haven1433
with MIT License
from haven1433
[Fact]
public void TryingToWriteStringFormatToNonStringFormatDataFails() {
ViewPort.Edit("^\"\" ");
replacedert.NotEmpty(Errors); // should get an error, because the data located at the cursor could not convert to a string.
}
19
Source : KeyDefinitionDictionaryTest.cs
with MIT License
from Invvard
with MIT License
from Invvard
[ Fact ]
public void InitializeKeyDefinitions()
{
// Arrange
// Act
var dictionary = new KeyDefinitionDictionary();
// replacedert
replacedert.NotEmpty(dictionary.KeyDefinitions);
replacedert.Equal(530, dictionary.KeyDefinitions.Count);
}
See More Examples