|
| 1 | +@IsTest |
| 2 | +private class MatchFieldsTest { |
| 3 | + @IsTest |
| 4 | + static void containsDecimal() { |
| 5 | + System.Assert.isTrue(new MatchFields().field(Opportunity.Amount).isIn(new Set<Decimal>{10.0}).call(new Opportunity(Amount = 10.0))); |
| 6 | + } |
| 7 | + |
| 8 | + @IsTest |
| 9 | + static void containsDouble() { |
| 10 | + System.Assert.isTrue(new MatchFields().field(Opportunity.Amount).isIn(new Set<Double>{10.0}).call(new Opportunity(Amount = 10.0))); |
| 11 | + } |
| 12 | + |
| 13 | + @IsTest |
| 14 | + static void containsInteger() { |
| 15 | + System.Assert.isTrue(new MatchFields().field(Account.NumberOfEmployees).isIn(new Set<Integer>{10}).call(new Account(NumberOfEmployees = 10))); |
| 16 | + } |
| 17 | + |
| 18 | + @IsTest |
| 19 | + static void containsBoolean() { |
| 20 | + System.Assert.isTrue(new MatchFields().field(Contact.DoNotCall).isIn(new Set<Boolean>{false}).call(new Contact(DoNotCall = false))); |
| 21 | + System.Assert.isFalse(new MatchFields().field(Contact.DoNotCall).isIn(new Set<Boolean>{true}).call(new Contact(DoNotCall = false))); |
| 22 | + } |
| 23 | + |
| 24 | + @IsTest |
| 25 | + static void containsDate() { |
| 26 | + Date today = Date.today(); |
| 27 | + System.Assert.isTrue(new MatchFields().field(Event.ActivityDate).isIn(new Set<Date>{today}).call(new Event(ActivityDate = today))); |
| 28 | + } |
| 29 | + |
| 30 | + @IsTest |
| 31 | + static void containsDatetime() { |
| 32 | + Datetime now = Datetime.now(); |
| 33 | + System.Assert.isTrue(new MatchFields().field(Event.ActivityDateTime).isIn(new Set<Datetime>{now}).call(new Event(ActivityDateTime = now))); |
| 34 | + } |
| 35 | + |
| 36 | + @IsTest |
| 37 | + static void containsId() { |
| 38 | + Id oppId = TestUtility.getFakeId(Opportunity.SObjectType); |
| 39 | + System.Assert.isTrue(new MatchFields().field(Opportunity.Id).isIn(new Set<Id>{oppId}).call(new Opportunity(Id = oppId))); |
| 40 | + System.Assert.isFalse(new MatchFields().field(Opportunity.Id).isIn(new Set<Id>{oppId}).call(new Opportunity(Id = TestUtility.getFakeId(Opportunity.SObjectType)))); |
| 41 | + } |
| 42 | + |
| 43 | + @IsTest |
| 44 | + static void containsString() { |
| 45 | + System.Assert.isTrue(new MatchFields().field(Opportunity.Name).isIn(new Set<String>{'foo'}).call(new Opportunity(Name = 'foo'))); |
| 46 | + System.Assert.isFalse(new MatchFields().field(Opportunity.Name).isIn(new Set<String>{'foo'}).call(new Opportunity(Name = 'bar'))); |
| 47 | + } |
| 48 | +} |
0 commit comments