public void TryGetBookPropertyWithEmptyISBN() { string isbn = string.Empty; string field = "title"; Challenge1.GetBookProperty(isbn, field); }
public void TryGetBookPropertyWithInvalidField() { string isbn = "978-1779501127"; string field = "potato"; Challenge1.GetBookProperty(isbn, field); }
public void TryGetBookPropertyWithInvalidISBN() { string isbn = "978-1617298028"; // Code Like A Pro in C# (Manning Publications, 2021) - Jort Rodenburg string field = "title"; Challenge1.GetBookProperty(isbn, field); }
public void TryGetBookPropertyWithValidISBN() { string isbn = "978-1779501127"; string field = "title"; string result = Challenge1.GetBookProperty(isbn, field); Assert.AreEqual("Watchmen", result); }
public void SolveChallenge_ShouldSolveChallengeString() { string input = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d"; string expected = "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t"; string actual = new Challenge1(input).SolveChallenge(); Assert.Equal(expected, actual); }
public void TestHexToBase64Converter() { // Arrange string expected = "SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t"; string input = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d"; // Act string actual = Challenge1.HexToBase64(input); // Assert Assert.Equal(expected, actual); }
public void GetIndeces_SolutionArray_Equals_ExpectedOutcome() { //Arrange Challenge1 challenge1 = new Challenge1(); int[] expected = { 3, 0 }; int[] inputArray = { 5, 17, 77, 50 }; int target = 55; //Act int[] actual = challenge1.GetIndeces(inputArray, target); //Assert CollectionAssert.AreEqual(expected, actual); }
public void GetIndeces_SecondValue_Equals_0() { //Arrange Challenge1 challenge1 = new Challenge1(); int[] expected = { 3, 0 }; int[] inputArray = { 5, 17, 77, 50 }; int target = 55; //Act int[] actual = challenge1.GetIndeces(inputArray, target); //Assert Assert.AreEqual(expected[1], actual[1]); }
public void ToBytes_UnPaddedBase64_Throws(string unPaddedBase64) { Assert.Throws <ArgumentException>(() => Challenge1.ToBytes(unPaddedBase64)); }
public void RoundtripBase64_EmptyString_EmptyBase64(string base64input) { var actual = Challenge1.ToBase64(Challenge1.ToBytes(base64input)); Assert.Equal(base64input, actual); }
public void ByteHexToBase64_ValidString_ValidBase64(string hexInput, string base64Output) { var actualBase64 = Challenge1.ByteHexToBase64(hexInput); Assert.Equal(base64Output, actualBase64); }
public void ToByte_NullArray_Throws() { Assert.Throws <ArgumentNullException>(() => Challenge1.ToByte(null)); }
public void ToByte_ArrayWithOneChar_Throws() { Assert.Throws <ArgumentOutOfRangeException>(() => Challenge1.ToByte(new char[1])); }
public void ToByte_InvalidHexCharsArray_Throws() { Assert.Throws <ArgumentException>(() => Challenge1.ToByte('Y', 'u')); }
public void ByteHexToByteArray_OddLengthString_Throws() { Assert.Throws <ArgumentException>(() => Challenge1.ByteHexToByteArray("thisIsOdd")); }
public void CalculateSum() { Assert.AreEqual(19, Challenge1.HourglassSum(ChallengeInput)); }
public void ToBytes_NullString_Throws() { Assert.Throws <ArgumentNullException>(() => Challenge1.ToBytes(null)); }
public void ToByte_UppercaseValidHexCharsArray_Throws() { Assert.Equal(0xFF, Challenge1.ToByte('F', 'F')); }
public void TestCase3() { Assert.AreEqual(-6, Challenge1.HourglassSum(TestCase3Input)); }
public void ByteHexToBase64_NullString_Throws() { Assert.Throws <ArgumentNullException>(() => Challenge1.ByteHexToBase64(null)); }