public void ConstructorWithError() { Assert.Throws <MyException>(() => new ClassWithPassword("hi!")); var secret = new ClassWithPassword("12345"); Assert.Equal(42u, secret.GetSpecialValueFromInstance()); }
public void GetStructAcceptsGoodPassword() { var result = ClassWithPassword.GetStruct("12345"); Assert.Equal(41, result.Test); Assert.Equal(StructureEnum.Var2, result.FirstEnumValue); Assert.Equal(1, result.Int1); Assert.False(result.Bool2); Assert.Equal(StructureEnum.Var2, result.SecondEnumValue); }
public void ThrowsBadPassword() { try { ClassWithPassword.GetSpecialValue("hi!"); Assert.True(false); } catch (MyException ex) { Assert.Equal(MyError.BadPassword, ex.error); } }
public void EchoPasswordAcceptsGoodPassword() { var result = ClassWithPassword.EchoPassword("12345"); Assert.Equal("12345", result); }
public void EchoPasswordThrowsOnBadPassword() { Assert.Throws <MyException>(() => ClassWithPassword.EchoPassword("hi!")); }
public void GetStructThrowsOnBadPassword() { Assert.Throws <MyException>(() => ClassWithPassword.GetStruct("hi!")); }
public void AcceptsGoodPassword() { Assert.Equal(42u, ClassWithPassword.GetSpecialValue("12345")); }