[TestCase(0, 0, 0)]
[TestCase(34, 25, 59)]
[TestCase(-1250, 10000, 8750)]
public void AddNumbersTest(int a, int b, int expected)
{
// Act
int result = a + b;
// Assert
Assert.That(result, Is.EqualTo(expected));
}
[TestCase(0, 0, 0)]
[TestCase(34, 25, 59)]
[TestCase(-1250, 10000, 8750)]
public void AddNumbersTest(int a, int b, int expected)
{
// Act
int result = a + b;
// Assert
Assert.That(result, Is.EqualTo(expected));
}
HTML Tag:
Tag attributes look similar to html, however their values are just regular JavaScript.
a(href='google.com') Google
a(class='button', href='google.com') Google
Result:
<a href="google.com">Google</a><a href="google.com" class="button">G...
By default, all attributes are escaped (replacing special characters with escape sequences) to prevent attacks such as cross site scripting. If you need to use special characters you can use != instead of =.
Code:
div(escaped="<code>")
div(unescaped!="<code>")
R...
Boolean attributes are mirrored by Jade, and accept bools, aka true or false. When no value is specified true is assumed.
Code:
input(type='checkbox', checked)
input(type='checkbox', checked=true)
input(type='checkbox', checked=false)
input(type='checkbox', checked=true.toString())
Result:
...
The style attribute can be a string (like any normal attribute) but it can also be an object, which is handy when parts of the style are generated by JavaScript.
Code:
a(style={color: 'red', background: 'green'})
Result:
<a style="color:red;background:green"></a>
The class attribute can be a string (like any normal attribute) but it can also be an array of class names, which is handy when generated from JavaScript.
Code:
- var classes = ['foo', 'bar', 'baz']
a(class=classes)
//- the class attribute may also be repeated to merge arrays
a.bing(class=class...
Pronounced "and attributes", the &attributes syntax can be used to explode an object into attributes of an element.
Code:
div#foo(data-bar="foo")&attributes({'data-foo': 'bar'})
Result:
<div id="foo" data-bar="foo" data-foo="bar">&l...
The preserveAspectRatio attribute has an optional parameter: meet | slice. The default behavior is meet which stretches the content in both the x and y dimension until it fills either the width or height of the viewBox. The alternative - slice preserves the aspect ratio of the content but scales up ...
All instances of an entity class with one of the class attributes matching a specified value can be retrieved as follows:
public interface FooRepository extends CrudRepository<Foo, Long> {
List<Foo> findAllByName(String name);
}
Invoking the findAllByName method results in the JP...
Attributes can be useful for denoting metadata on enums. Getting the value of this can be slow, so it is important to cache results.
private static Dictionary<object, object> attributeCache = new Dictionary<object, object>();
public static T GetAttribute<T, V>(this V va...
XPath selectors can be used to select elements with specific attributes, such as class, id, title etc.
By Class
View:
<div class="HakunaMatata"> Hakuna Matata </div>
Code:
var theLionKing= element(by.xpath('//div[@class="HakunaMatata"]'));
expect(theLionKing.g...
HTML to NSAttributedString conversion Code :-
//HTML String
NSString *htmlString=[[NSString alloc]initWithFormat:@"<!DOCTYPE html><html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>"];
//Converting HTML s...
Objective-C
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"Hello. That is a test attributed string."];
[str addAttribute:NSBackgroundColorAttributeName value:[UIColor yellowColor] range:NSMakeRange(3,5)];
[str addAttribute:NSForegroundColorAttrib...
3.3
Instancing can be done via modifications to how vertex attributes are provided to the vertex shader. This introduces a new way of accessing attribute arrays, allowing them to provide per-instance data that looks like a regular attribute.
A single instance represents one object or group of vert...