Skip to content

Commit

Permalink
update assertion sentence
Browse files Browse the repository at this point in the history
  • Loading branch information
eryeer committed Oct 8, 2019
1 parent ff83a9d commit 8b2fea7
Show file tree
Hide file tree
Showing 17 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void TestConcatenatedIteratorAndDispose()
ConcatenatedEnumerator uut = new ConcatenatedEnumerator(it1, it2);
Assert.IsNotNull(uut);
Action action = () => uut.Dispose();
action.ShouldNotThrow<Exception>();
action.Should().NotThrow<Exception>();
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void TestGeneratorAndDispose()
IteratorKeysWrapper iteratorKeysWrapper = new IteratorKeysWrapper(new ArrayWrapper(new List<StackItem>()));
Assert.IsNotNull(iteratorKeysWrapper);
Action action = () => iteratorKeysWrapper.Dispose();
action.ShouldNotThrow<Exception>();
action.Should().NotThrow<Exception>();
}

[TestMethod]
Expand All @@ -29,7 +29,7 @@ public void TestNextAndValue()
ArrayWrapper wrapper = new ArrayWrapper(list);
IteratorKeysWrapper iteratorKeysWrapper = new IteratorKeysWrapper(wrapper);
Action action = () => iteratorKeysWrapper.Next();
action.ShouldNotThrow<Exception>();
action.Should().NotThrow<Exception>();
Assert.AreEqual(new VM.Types.Integer(0), iteratorKeysWrapper.Value());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void TestGeneratorAndDispose()
IteratorValuesWrapper iteratorValuesWrapper = new IteratorValuesWrapper(new ArrayWrapper(new List<StackItem>()));
Assert.IsNotNull(iteratorValuesWrapper);
Action action = () => iteratorValuesWrapper.Dispose();
action.ShouldNotThrow<Exception>();
action.Should().NotThrow<Exception>();
}

[TestMethod]
Expand All @@ -30,7 +30,7 @@ public void TestNextAndValue()
ArrayWrapper wrapper = new ArrayWrapper(list);
IteratorValuesWrapper iteratorValuesWrapper = new IteratorValuesWrapper(wrapper);
Action action = () => iteratorValuesWrapper.Next();
action.ShouldNotThrow<Exception>();
action.Should().NotThrow<Exception>();
Assert.AreEqual(stackItem, iteratorValuesWrapper.Value());
}
}
Expand Down
6 changes: 3 additions & 3 deletions neo.UnitTests/SmartContract/Iterators/UT_ArrayWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void TestGeneratorAndDispose()
ArrayWrapper arrayWrapper = new ArrayWrapper(new List<StackItem>());
Assert.IsNotNull(arrayWrapper);
Action action = () => arrayWrapper.Dispose();
action.ShouldNotThrow<Exception>();
action.Should().NotThrow<Exception>();
}

[TestMethod]
Expand All @@ -28,9 +28,9 @@ public void TestKeyAndValue()
list.Add(stackItem);
ArrayWrapper arrayWrapper = new ArrayWrapper(list);
Action action1 = () => arrayWrapper.Key();
action1.ShouldThrow<InvalidOperationException>();
action1.Should().Throw<InvalidOperationException>();
Action action2 = () => arrayWrapper.Value();
action2.ShouldThrow<InvalidOperationException>();
action2.Should().Throw<InvalidOperationException>();
arrayWrapper.Next();
Assert.AreEqual(stackItem, arrayWrapper.Key());
Assert.AreEqual(stackItem, arrayWrapper.Value());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void TestDispose()
ArrayWrapper it2 = new ArrayWrapper(array2);
ConcatenatedIterator uut = new ConcatenatedIterator(it1, it2);
Action action = () => uut.Dispose();
action.ShouldNotThrow<Exception>();
action.Should().NotThrow<Exception>();
}
}
}
2 changes: 1 addition & 1 deletion neo.UnitTests/SmartContract/Iterators/UT_MapWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void TestGeneratorAndDispose()
MapWrapper mapWrapper = new MapWrapper(new List<KeyValuePair<StackItem, StackItem>>());
Assert.IsNotNull(mapWrapper);
Action action = () => mapWrapper.Dispose();
action.ShouldNotThrow<Exception>();
action.Should().NotThrow<Exception>();
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void TestGeneratorAndDispose()
StorageIterator storageIterator = new StorageIterator(new List<KeyValuePair<StorageKey, StorageItem>>().GetEnumerator());
Assert.IsNotNull(storageIterator);
Action action = () => storageIterator.Dispose();
action.ShouldNotThrow<Exception>();
action.Should().NotThrow<Exception>();
}

[TestMethod]
Expand Down
4 changes: 2 additions & 2 deletions neo.UnitTests/SmartContract/Manifest/UT_WildCardContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void TestFromJson()

jstring = new JString("hello world");
Action action = () => WildCardContainer<string>.FromJson(jstring, u => u.AsString());
action.ShouldThrow<FormatException>();
action.Should().Throw<FormatException>();

JObject alice = new JObject();
alice["name"] = "alice";
Expand All @@ -31,7 +31,7 @@ public void TestFromJson()

JBoolean jbool = new JBoolean();
action = () => WildCardContainer<string>.FromJson(jbool, u => u.AsString());
action.ShouldThrow<FormatException>();
action.Should().Throw<FormatException>();
}

[TestMethod]
Expand Down
8 changes: 4 additions & 4 deletions neo.UnitTests/SmartContract/Native/Tokens/UT_NeoToken.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public void TestCalculateBonus()
}.ToByteArray()
});
Action action = () => NativeContract.NEO.UnclaimedGas(snapshot, UInt160.Zero, 10).Should().Be(new BigInteger(0));
action.ShouldThrow<ArgumentOutOfRangeException>();
action.Should().Throw<ArgumentOutOfRangeException>();
snapshot.Storages.Delete(key);
snapshot.Storages.GetAndChange(key, () => new StorageItem
{
Expand Down Expand Up @@ -419,7 +419,7 @@ public void TestInitialize()
Snapshot snapshot = Store.GetSnapshot().Clone();
var engine = new ApplicationEngine(TriggerType.System, null, snapshot, 0, true);
Action action = () => NativeContract.NEO.Initialize(engine);
action.ShouldThrow<InvalidOperationException>();
action.Should().Throw<InvalidOperationException>();

engine = new ApplicationEngine(TriggerType.Application, null, snapshot, 0, true);
NativeContract.NEO.Initialize(engine).Should().BeFalse();
Expand Down Expand Up @@ -509,15 +509,15 @@ public void TestValidatorsCountState_FromByteArray()
{
ValidatorsCountState input = new ValidatorsCountState { Votes = new BigInteger[] { new BigInteger(1000) } };
ValidatorsCountState output = ValidatorsCountState.FromByteArray(input.ToByteArray());
output.ShouldBeEquivalentTo(input);
output.Should().BeEquivalentTo(input);
}

[TestMethod]
public void TestValidatorState_FromByteArray()
{
ValidatorState input = new ValidatorState { Votes = new BigInteger(1000) };
ValidatorState output = ValidatorState.FromByteArray(input.ToByteArray());
output.ShouldBeEquivalentTo(input);
output.Should().BeEquivalentTo(input);
}

[TestMethod]
Expand Down
2 changes: 1 addition & 1 deletion neo.UnitTests/SmartContract/Native/UT_NativeContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void TestInitialize()

ae = new ApplicationEngine(TriggerType.System, null, null, 0);
Action action = () => pc.Initialize(ae);
action.ShouldThrow<InvalidOperationException>();
action.Should().Throw<InvalidOperationException>();
}

[TestMethod]
Expand Down
2 changes: 1 addition & 1 deletion neo.UnitTests/SmartContract/UT_ApplicationEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void TestDisposable()
var engine = new ApplicationEngine(TriggerType.Application, null, snapshot, 0, true);
engine.AddDisposable(replica).Should().Be(replica);
Action action = () => engine.Dispose();
action.ShouldNotThrow();
action.Should().NotThrow();
}

private void Test_Log1(object sender, LogEventArgs e)
Expand Down
6 changes: 3 additions & 3 deletions neo.UnitTests/SmartContract/UT_ContainerPlaceholder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ public void TestEquals()
{
ContainerPlaceholder containerPlaceholder = new ContainerPlaceholder();
Action action = () => containerPlaceholder.Equals(new Integer(0));
action.ShouldThrow<NotSupportedException>();
action.Should().Throw<NotSupportedException>();
}

[TestMethod]
public void TestGetBoolean()
{
ContainerPlaceholder containerPlaceholder = new ContainerPlaceholder();
Action action = () => containerPlaceholder.GetBoolean();
action.ShouldThrow<NotImplementedException>();
action.Should().Throw<NotImplementedException>();
}

[TestMethod]
public void TestGetByteArray()
{
ContainerPlaceholder containerPlaceholder = new ContainerPlaceholder();
Action action = () => containerPlaceholder.GetByteArray();
action.ShouldThrow<NotSupportedException>();
action.Should().Throw<NotSupportedException>();
}
}
}
2 changes: 1 addition & 1 deletion neo.UnitTests/SmartContract/UT_Contract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void TestCreateMultiSigRedeemScript()
publicKeys[1] = key2.PublicKey;
publicKeys = publicKeys.OrderBy(p => p).ToArray();
Action action = () => Contract.CreateMultiSigRedeemScript(0, publicKeys);
action.ShouldThrow<ArgumentException>();
action.Should().Throw<ArgumentException>();
byte[] script = Contract.CreateMultiSigRedeemScript(2, publicKeys);
byte[] expectedArray = new byte[75];
expectedArray[0] = 0x52;
Expand Down
8 changes: 4 additions & 4 deletions neo.UnitTests/SmartContract/UT_ContractParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void TestGenerator2()
Assert.AreEqual(0, ((List<KeyValuePair<ContractParameter, ContractParameter>>)contractParameter10.Value).Count);

Action action = () => new ContractParameter(ContractParameterType.Void);
action.ShouldThrow<ArgumentException>();
action.Should().Throw<ArgumentException>();
}

[TestMethod]
Expand Down Expand Up @@ -116,7 +116,7 @@ public void TestFromAndToJson()
JObject jobject11 = contractParameter11.ToJson();
jobject11["type"] = "Void";
Action action = () => ContractParameter.FromJson(jobject11);
action.ShouldThrow<ArgumentException>();
action.Should().Throw<ArgumentException>();
}

[TestMethod]
Expand All @@ -127,7 +127,7 @@ public void TestSetValue()
contractParameter1.SetValue(new byte[64].ToHexString());
Assert.AreEqual(Encoding.Default.GetString(expectedArray1), Encoding.Default.GetString((byte[])contractParameter1.Value));
Action action1 = () => contractParameter1.SetValue(new byte[50].ToHexString());
action1.ShouldThrow<FormatException>();
action1.Should().Throw<FormatException>();

ContractParameter contractParameter2 = new ContractParameter(ContractParameterType.Boolean);
contractParameter2.SetValue("true");
Expand Down Expand Up @@ -167,7 +167,7 @@ public void TestSetValue()

ContractParameter contractParameter9 = new ContractParameter(ContractParameterType.Array);
Action action9 = () => contractParameter9.SetValue("AAA");
action9.ShouldThrow<ArgumentException>();
action9.Should().Throw<ArgumentException>();
}

[TestMethod]
Expand Down
4 changes: 2 additions & 2 deletions neo.UnitTests/SmartContract/UT_ContractParameterContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void TestParse()
public void TestFromJson()
{
Action action = () => ContractParametersContext.Parse("{\"type\":\"wrongType\",\"hex\":\"0000000000f277f1144035a43897f9fa115258eac015adcabe0000000000000000000000000000000000000000000100\",\"items\":{\"0xbecaad15c0ea585211faf99738a4354014f177f2\":{\"script\":\"21026ff03b949241ce1dadd43519e6960e0a85b41a69a05c328103aa2bce1594ca1668747476aa\",\"parameters\":[{\"type\":\"Signature\",\"value\":\"01\"}]}}}");
action.ShouldThrow<FormatException>();
action.Should().Throw<FormatException>();
}

[TestMethod]
Expand Down Expand Up @@ -123,7 +123,7 @@ public void TestAddSignature()

contract1.ParameterList = new[] { ContractParameterType.Signature, ContractParameterType.Signature };
Action action1 = () => context.AddSignature(contract1, key.PublicKey, new byte[] { 0x01 });
action1.ShouldThrow<NotSupportedException>();
action1.Should().Throw<NotSupportedException>();

//multiSign

Expand Down
6 changes: 3 additions & 3 deletions neo.UnitTests/SmartContract/UT_NefFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void TestDeserialize()
ms.Seek(0, SeekOrigin.Begin);
ISerializable newFile = new NefFile();
Action action = () => newFile.Deserialize(reader);
action.ShouldThrow<FormatException>();
action.Should().Throw<FormatException>();
}

file.CheckSum = 0;
Expand All @@ -50,7 +50,7 @@ public void TestDeserialize()
ms.Seek(0, SeekOrigin.Begin);
ISerializable newFile = new NefFile();
Action action = () => newFile.Deserialize(reader);
action.ShouldThrow<FormatException>();
action.Should().Throw<FormatException>();
}

file.CheckSum = NefFile.ComputeChecksum(file);
Expand All @@ -63,7 +63,7 @@ public void TestDeserialize()
ms.Seek(0, SeekOrigin.Begin);
ISerializable newFile = new NefFile();
Action action = () => newFile.Deserialize(reader);
action.ShouldThrow<FormatException>();
action.Should().Throw<FormatException>();
}

file.ScriptHash = file.Script.ToScriptHash();
Expand Down
8 changes: 4 additions & 4 deletions neo.UnitTests/SmartContract/UT_SmartContractHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void TestSerialize()

StackItem stackItem4 = new InteropInterface<object>(new object());
Action action4 = () => Neo.SmartContract.Helper.Serialize(stackItem4);
action4.ShouldThrow<NotSupportedException>();
action4.Should().Throw<NotSupportedException>();

StackItem stackItem5 = new VM.Types.Integer(1);
byte[] result5 = Neo.SmartContract.Helper.Serialize(stackItem5);
Expand Down Expand Up @@ -184,12 +184,12 @@ public void TestSerialize()
Map stackItem91 = new VM.Types.Map();
stackItem91.Add(stackItem9, stackItem91);
Action action9 = () => Neo.SmartContract.Helper.Serialize(stackItem91);
action9.ShouldThrow<NotSupportedException>();
action9.Should().Throw<NotSupportedException>();

VM.Types.Array stackItem10 = new VM.Types.Array();
stackItem10.Add(stackItem10);
Action action10 = () => Neo.SmartContract.Helper.Serialize(stackItem10);
action10.ShouldThrow<NotSupportedException>();
action10.Should().Throw<NotSupportedException>();
}

[TestMethod]
Expand All @@ -214,7 +214,7 @@ public void TestDeserializeStackItem()
byte[] byteArray4 = Neo.SmartContract.Helper.Serialize(stackItem4);
byteArray4[0] = 0x40;
Action action4 = () => Neo.SmartContract.Helper.DeserializeStackItem(byteArray4, 1, (uint)byteArray4.Length);
action4.ShouldThrow<FormatException>();
action4.Should().Throw<FormatException>();

StackItem stackItem51 = new VM.Types.Integer(1);
List<StackItem> list5 = new List<StackItem>();
Expand Down

0 comments on commit 8b2fea7

Please sign in to comment.