Skip to content

Instantly share code, notes, and snippets.

@maaretp
maaretp / gist:ff4638ae7d9f21f19af0
Last active August 29, 2015 14:13
First Unit Test - before
[TestClass]
public class ClaimEqualityComparerTest : BaseTest
{
[TestMethod]
public void Equals_ClaimsAreEqual_ReturnsTrue()
{
var claim1 = new Claim { Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", Value = "Foo" };
var claim2 = new Claim { Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", Value = "Foo" };
var comparator = new ClaimEqualityComparer();
comparator.Equals(claim1, claim2).Should().BeTrue();
@maaretp
maaretp / gist:5b96936ecd72c616a15d
Last active August 29, 2015 14:13
First Unit Test - after
[TestClass]
public class ClaimEqualityComparerTest : BaseTest
{
[TestMethod]
public void ClaimsAreEqual()
{
var identical = new Claim { Type = "Type", Value = "Value" };
var sameType = new Claim { Type = "TYPE", Value = "Value" };
AssertEquality(true, identical, sameType);
}
. . . .
. . B B
. . . .
. . . .
. . . .
1)
* *
*
public void testSomething() throws Exception {
String[] items = { "Any" };
Integer[] sellins = { 0 };
Integer[] qualities = { 0 };
CombinationApprovals.verifyAllCombinations(this::checkItem, items, sellins, qualities);
}
@maaretp
maaretp / CheckItem.java
Created August 12, 2018 06:37
CheckItem method for Gilded Rose
public GildedRose checkItem(String item, Integer sellin, Integer quality) {
Item[] items = new Item[] { new Item(item, sellin, quality) };
GildedRose app = new GildedRose(items);
app.updateQuality();
return app;
}
package com.gildedrose;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class GildedRoseTest {
@Test
public void AfterSellByDateDegradeDouble() {
package com.gildedrose;
import org.approvaltests.combinations.CombinationApprovals;
import org.approvaltests.legacycode.Range;
import junit.framework.TestCase;
public class GildedRoseApprovalTest extends TestCase {
public void testSomething() throws Exception {
args: (0,) => 'zero'
args: (1,) => ' one'
args: (2,) => ' two'
args: (3,) => ' three'
args: (4,) => ' four'
args: (5,) => ' five'
args: (6,) => ' six'
args: (7,) => ' seven'
args: (8,) => ' eight'
args: (9,) => ' nine'
Feature: User management
As an administrator,
I can define users selecting roles with every role able to view observations,
So that users have access to intended information.
Scenario: Admin can create admins
Given Default admin logs in to user management
Then Admin can create admin users
Then New admin user exists on the users list
And New admin user can login