public void Inequality_IsEqual() { var a = new Quaternion(1, 1, 1, 1); var b = new Quaternion(1, 1, 1, 1); Assert.False(a != b); }
public void Equality_IsInequal() { var a = new Quaternion(1, 1, 1, 1); var b = new Quaternion(0, 0, 0, 0); Assert.False(a == b); }
public void PatternChronologyDTOIsEquivalentTest() { { PatternChronologyDTO a = Misc.CreatePatternChronologyDTO; PatternChronologyDTO b = Misc.CreatePatternChronologyDTO; Assert.True(a.IsEquivalent(b)); } { PatternChronologyDTO a = Misc.CreatePatternChronologyDTO; PatternChronologyDTO b = Misc.CreatePatternChronologyDTO with { PublicId = new PublicId(Misc.other) }; Assert.False(a.IsEquivalent(b)); } { PatternChronologyDTO a = Misc.CreatePatternChronologyDTO; PatternChronologyDTO b = Misc.CreatePatternChronologyDTO with { Versions = new PatternVersionDTO[] { Misc.CreatePatternVersionDTO with { PublicId = new PublicId(Misc.other) } }.ToImmutableArray()
public void DifferentListCompanions_returnDifferent() { var current1 = new SynchronEvent().AddCompanions("*****@*****.**").AddCompanions("*****@*****.**"); var current2 = new SynchronEvent().AddCompanions("*****@*****.**").AddCompanions("*****@*****.**"); Assert.False(current1.CompareOnEqual(current2)); }
public void Error_Message_If_The_Email_Is_NotValid() { //Arrange string userName = GenerateString(10); string password = GenerateString(10); string notValidEmail = GenerateString(10); string validEmail = GenerateString(10) + "@test.com"; string expectedErrorMessage = "Enter a valid email address."; //Act LoginPage loginPage = OpenSite(); loginPage.EnterAccountInfo(userName: userName, password: password, confirmPassword: password, email: notValidEmail, name: null, lastName: null); loginPage.PressEnterEmailInput(); //Assert Verify validation errors appears if the email address is not valid Assert.True(loginPage.IsTextDisplayed(expectedErrorMessage, "li")); //Act loginPage.EnterEmail(validEmail); loginPage.PressEnterEmailInput(); //Assert Verify validation errors disappear after entering valid email and pressing enter Assert.False(loginPage.IsTextDisplayed(expectedErrorMessage, "li")); }
public void Verify_Camera_Exception_Cases() { var cameraStatus = new NestCameraStatus(); Assert.Throws <NestCameraOfflineException>(() => cameraStatus.ThrowExceptionIfCameraIsntOnlineAndStreaming(new NestCameraJson())); Assert.Throws <NestCameraOfflineException>(() => cameraStatus.ThrowExceptionIfCameraIsntOnlineAndStreaming(new NestCameraJson { IsOnline = true })); Assert.Throws <NestCameraOfflineException>(() => cameraStatus.ThrowExceptionIfCameraIsntOnlineAndStreaming(new NestCameraJson { IsStreaming = true // Probably isn't posible to be streaming and offline...This is a test case I can remove when I gain experience and comfort with this problem area. For now however, I'm validating the API's themselves and making no assumptions. })); var fullyOnlineCamera = new NestCameraJson { IsOnline = true, IsStreaming = true }; cameraStatus.ThrowExceptionIfCameraIsntOnlineAndStreaming(fullyOnlineCamera); Assert.False(cameraStatus.IsOffline(fullyOnlineCamera)); }
public async Task Test() { var disco = await this._client.GetDiscoveryDocumentAsync(PluginConstant.Host); Assert.False(disco.IsError, disco.Error); // request token var tokenResponse = await _client.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest { Address = disco.TokenEndpoint, ClientId = "client", ClientSecret = "secret", Scope = "api1" }); Assert.False(tokenResponse.IsError, tokenResponse.Error); this.WriteLine(tokenResponse.Json); this._client.SetBearerToken(tokenResponse.AccessToken); await this.Request("/weatherforecast"); await this.Request("/api/weatherforecast"); }
public void Equality_IsInequal() { var a = new float3x3(1, 1, 1, 1, 1, 1, 1, 1, 1); var b = new float3x3(0, 0, 0, 0, 0, 0, 0, 0, 0); Assert.False((a == b)); }
public async void MockServerProcessorCancelTokenAfterRequest() { _mockServerProcessor = new MockServerProcessor(new AssertFactory(), new RuleMatcher(), new TemplateContext()); var scenarios = GenerateRandomScenarios(out var httpContext); var input = new MessageProcessorInput(httpContext.Request, scenarios); var Target = _mockServerProcessor; var cancelledTokenSource = new CancellationTokenSource(); Target.Start(); // fill the pipeline with tasks var fillPipeline = new Task(() => { while (true) { _ = Target.Push(input, cancelledTokenSource.Token); } }); fillPipeline.Start(); await Task.Delay(1000); cancelledTokenSource.Cancel(); var Actual = Target.PipelineIsRunning; // should not accept anymore data after it has been cancelled _ = Target.Push(input, cancelledTokenSource.Token); Assert.False(Actual); }
public void ConceptChronologyDTOCompareToTest() { { ConceptChronologyDTO a = Misc.CreateConceptChronologyDTO; ConceptChronologyDTO b = Misc.CreateConceptChronologyDTO; Assert.True(a.CompareTo(b) == 0); } { ConceptChronologyDTO a = Misc.CreateConceptChronologyDTO; ConceptChronologyDTO b = Misc.CreateConceptChronologyDTO with { PublicId = new PublicId(Misc.g2, Misc.g2, Misc.g3, Misc.g4) }; Assert.False(a.CompareTo(b) == 0); } { ConceptChronologyDTO a = new ConceptChronologyDTO( Misc.PublicIdG, Misc.ConceptVersionsBase(Misc.PublicIdG).ToImmutableArray() ); ConceptChronologyDTO b = new ConceptChronologyDTO( Misc.PublicIdG, new ConceptVersionDTO[] { Misc.cv1(Misc.PublicIdG) }.ToImmutableArray() ); Assert.False(a.CompareTo(b) == 0); } }
public void Assertions() { var condition = false; var text = "something"; var obj = new Auto(); var tokens = new List <string> { "public", "void", "return" }; var zero = 8 - 8; var someEnumerable = new List <string>(); Assert.False(condition); Assert.Equal("something", text); Assert.NotEqual("something else", text); Assert.Contains("tech", "technology"); // also DoesNotContain Assert.Matches(".*thing$", "something"); Assert.Throws <DivideByZeroException>(() => 4 / zero); Assert.Empty(someEnumerable); // also NotEmpty Assert.IsType <Auto>(obj); Assert.Collection(new List <int> { 2, 4 }, n => Assert.Equal(2, n), n => Assert.Equal(4, n) ); Assert.All(new List <string> { "a", "ab", "abc" }, s => s.StartsWith("a")); }
public void PrepareEZLayout_KeyCategoryWithSimpleLabel(string keyCode, string expectedLabel, KeyCategory expectedCategory) { // Arrange var ergodoxKey = new ErgodoxKey() { GlowColor = "", Code = keyCode }; ErgodoxLayout ergodoxLayout = InitializeDataTree(); ergodoxLayout.Revision.Layers.First().Keys.Add(ergodoxKey); EZLayout ezLayoutResult; // Act var ezLayoutMaker = new EZLayoutMaker(); ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout); // Assert Assert.Single(ezLayoutResult.EZLayers); Assert.Single(ezLayoutResult.EZLayers.First().EZKeys); var keyResult = ezLayoutResult.EZLayers.First().EZKeys.First(); Assert.Equal(expectedLabel, keyResult.Label.Content); Assert.False(keyResult.Label.IsGlyph); Assert.Equal(expectedCategory, keyResult.KeyCategory); }
public void BodyRuleEqualsRuleFailsTest() { var Target = this.fakerBodyRule.Generate(); var input = new BodyRule(Target.Type, new JObject()) as object; Assert.False(Target.Equals(input)); }
public void Add_WithTheSameLocation_ReturnUnsuccessful( FriendService sut, Friend newFriend) { var myFriendsCollection = Builder <Friend> .CreateListOfSize(10).All() .TheFirst(1) .With(x => x.Name = "Sergio") .With(x => x.Location = new Location { Latitude = 10, Longitude = 10 }) .Build() .ToList(); sut.InMemoryCacheService.Remove(CacheKey); sut.InMemoryCacheService.Insert(CacheKey, myFriendsCollection); newFriend.Location.Latitude = 10; newFriend.Location.Longitude = 10; var result = sut.Add(newFriend); Assert.False(result.Succeeded); Assert.True(result.Reason == ServiceResultFailReason.BusinessValidation); Assert.Contains("Já existe um amigo nessa mesma localização.", result.Errors); }
public void SemanticDTOCompareToTest() { { SemanticDTO a = Misc.CreateSemanticDTO; SemanticDTO b = new SemanticDTO( Misc.PublicIdG ); Assert.True(a.CompareTo(b) == 0); } { SemanticDTO a = Misc.CreateSemanticDTO; SemanticDTO b = new SemanticDTO( new PublicId(Misc.g2, Misc.g2, Misc.g3, Misc.g4) ); Assert.False(a.CompareTo(b) == 0); } { SemanticDTO a = Misc.CreateSemanticDTO; SemanticDTO b = new SemanticDTO( Misc.PublicIdG ); Assert.False(a.CompareTo(b) == 0); } { SemanticDTO a = Misc.CreateSemanticDTO; SemanticDTO b = new SemanticDTO( Misc.PublicIdG ); Assert.False(a.CompareTo(b) == 0); } }
public void SemanticDTOIsEquivalentTest() { { SemanticDTO a = Misc.CreateSemanticDTO; SemanticDTO b = new SemanticDTO( Misc.PublicIdG ); Assert.True(a.IsEquivalent(b)); } { SemanticDTO a = Misc.CreateSemanticDTO; SemanticDTO b = new SemanticDTO( new PublicId(Misc.other) ); Assert.False(a.IsEquivalent(b)); } { SemanticDTO a = Misc.CreateSemanticDTO; SemanticDTO b = new SemanticDTO( Misc.PublicIdG ); Assert.False(a.IsEquivalent(b)); } { SemanticDTO a = Misc.CreateSemanticDTO; SemanticDTO b = new SemanticDTO( Misc.PublicIdG ); Assert.False(a.IsEquivalent(b)); } }
public void ConceptChronologyDTOIsEquivalentTest() { { ConceptChronologyDTO a = Misc.CreateConceptChronologyDTO; ConceptChronologyDTO b = Misc.CreateConceptChronologyDTO; Assert.True(a.IsEquivalent(b)); } { ConceptChronologyDTO a = Misc.CreateConceptChronologyDTO; ConceptChronologyDTO b = Misc.CreateConceptChronologyDTO with { PublicId = new PublicId(Misc.other) }; Assert.False(a.IsEquivalent(b)); } { ConceptChronologyDTO a = new ConceptChronologyDTO( Misc.PublicIdG, Misc.ConceptVersionsBase(Misc.PublicIdG).ToImmutableArray() ); ConceptChronologyDTO b = new ConceptChronologyDTO( Misc.PublicIdG, new ConceptVersionDTO[] { Misc.cv1(Misc.PublicIdG) }.ToImmutableArray() ); Assert.False(a.IsEquivalent(b)); } }
public void Inequality_IsEqual() { var a = new float3x3(1, 1, 1, 1, 1, 1, 1, 1, 1); var b = new float3x3(1, 1, 1, 1, 1, 1, 1, 1, 1); Assert.False((a != b)); }
public void NullableTest() { Assert.True(Conversion.IsNullable(typeof(string))); Assert.False(Conversion.IsNullable(typeof(double))); Assert.True(Conversion.IsNullable(typeof(double?))); Assert.True(Conversion.IsNullable(typeof(int?))); Assert.True(Conversion.IsNullable(typeof(KeyValuePair <int, int>?))); }
public static void IsFalse(bool condition, string message = null) { #if XUNIT XUnitAssert.False(condition); #else NUnitAssert.IsFalse(condition, message); #endif }
public void EqualsFailsNullTest() { var Target = mockDefinitionFake.Generate(); var Actual = Target.Equals(null); Assert.False(Actual); }
public void IsAvailableOutWhenBranchIsSet() { var holding = new Holding { BranchId = 1 }; Assert.False(holding.IsCheckedOut); Assert.True(holding.IsAvailable); }
public async Task Bonus_DeactivateBonusAsync_Return_BonusDTO() { CreateDefaultBonusServiceInstance(); var idBonus = _fakeBonuseDtos[0].Id; var bonus = await _bonusService.DeactivateBonusAsync(idBonus, default(CancellationToken)); Assert.False(bonus.IsActive); }
public void BodyRuleEqualsTypeFailsTest() { var Target = this.fakerBodyRule.Generate(); Target.Type = ComparerType.JSONEQUALITY; var input = new BodyRule(ComparerType.JSONCONTAINS, Target.RuleValue) as object; Assert.False(Target.Equals(input)); }
public void IsCheckedOutWhenBranchIsTheCheckedOutBranch() { var holding = new Holding { BranchId = Branch.CheckedOutId }; Assert.True(holding.IsCheckedOut); Assert.False(holding.IsAvailable); }
public void PrepareEZLayout_ProcessModifiers(bool leftAlt, bool leftCtrl, bool leftShift, bool leftWin, bool rightAlt, bool rightCtrl, bool rightShift, bool rightWin, string expectedSubLabel, KeyDisplayType expectedDisplayType) { // Arrange var modifiers = new ErgodoxModifiers { LeftAlt = leftAlt, LeftCtrl = leftCtrl, LeftShift = leftShift, LeftWin = leftWin, RightAlt = rightAlt, RightCtrl = rightCtrl, RightShift = rightShift, RightWin = rightWin }; var ergodoxKey = new ErgodoxKey() { GlowColor = "", Code = "KC_A", Modifiers = modifiers }; ErgodoxLayout ergodoxLayout = InitializeDataTree(); ergodoxLayout.Revision.Layers.First().Keys.Add(ergodoxKey); EZLayout ezLayoutResult; // Act var ezLayoutMaker = new EZLayoutMaker(); ezLayoutResult = ezLayoutMaker.PrepareEZLayout(ergodoxLayout); // Assert Assert.Single(ezLayoutResult.EZLayers); Assert.Single(ezLayoutResult.EZLayers.First().EZKeys); var keyResult = ezLayoutResult.EZLayers.First().EZKeys.First(); Assert.Equal("A", keyResult.Label.Content); if (expectedDisplayType == KeyDisplayType.SimpleLabel) { Assert.Null(keyResult.Modifier); } else { Assert.Equal(expectedSubLabel, keyResult.Modifier.Content); Assert.False(keyResult.Modifier.IsGlyph); } Assert.Equal(expectedDisplayType, keyResult.DisplayType); }
public void EqualsFailsNullMetadataTest() { #region Test Setup var metadataInfo = metadataInfoFake.Generate(); #endregion var Actual = metadataInfo.Equals(null); Assert.False(Actual); }
public void Add_WithLocationIsNull_ReturnUnsuccessful(FriendService sut, Friend newFriend) { newFriend.Location = null; var result = sut.Add(newFriend); Assert.False(result.Succeeded); Assert.True(result.Reason == ServiceResultFailReason.BusinessValidation); Assert.Contains("Infome a localização do seu amigo.", result.Errors); }
public void Add_WithNameIsEmpty_ReturnUnsuccessful(FriendService sut, Friend newFriend) { newFriend.Name = string.Empty; var result = sut.Add(newFriend); Assert.False(result.Succeeded); Assert.True(result.Reason == ServiceResultFailReason.BusinessValidation); Assert.Contains("Informe o nome do seu amigo", result.Errors); }
public void KeyValuePairRuleEqualsRuleFailsTest() { var Target = this.fakerKeyValuePairRule.Generate(); var input = new KeyValuePairRule() { Type = Target.Type, RuleValue = new KeyValuePair <string, string>() } as object; Assert.False(Target.Equals(input)); }