public void Indexer_Doesnt_Throw_If_Replacing_Conflicting(ResponseTypeInfo a, ResponseTypeInfo b) { var collection = new ResponseTypeInfoCollection() { a }; collection[0] = b; // Should not throw. }
public void Holds_Correct_Value( IEnumerable <ResponseTypeInfo> possibleResponseTypes, int?expectedIndex, int forStatusCode) { // The property can be null, if the status code doesn't match any info. // -> Thus, the index can be null too. ResponseTypeInfo expected = null; if (expectedIndex is {})
public void Insert_Throws_For_Conflicts(ResponseTypeInfo a, ResponseTypeInfo b) { var collection = new ResponseTypeInfoCollection() { a }; Action testCode = () => collection.Insert(0, b); testCode.Should().Throw <InvalidOperationException>(); }
public void Indexer_Throws_For_Conflicts(ResponseTypeInfo a, ResponseTypeInfo b) { var collection = new ResponseTypeInfoCollection() { a, new ResponseTypeInfo(typeof(object), new StatusCodeRange[] { 0 }, () => null), }; Action testCode = () => collection[1] = b; testCode.Should().Throw <InvalidOperationException>(); }
public void Returns_Expected_String(Type responseType, IEnumerable <StatusCodeRange> statusCodes, string expected) { var info = new ResponseTypeInfo(responseType, statusCodes, () => null); info.ToString().Should().Be(expected); }