Stumps.Server.StumpsServerInstance.StumpNameExists C# (CSharp) Method

StumpNameExists() public method

Determines if a stump with the specified name exists.
public StumpNameExists ( string stumpName ) : bool
stumpName string The name of the stump.
return bool
        public bool StumpNameExists(string stumpName)
        {
            var stumpList = new List<StumpContract>(FindAllContracts());
            var stump = stumpList.Find(s => s.StumpName.Equals(stumpName, StringComparison.OrdinalIgnoreCase));
            var stumpNameExists = stump != null;

            return stumpNameExists;
        }

Usage Example

        public void StumpNameExists_WithExistantName_ReturnsTrue()
        {
            var contract = new StumpContract()
            {
                OriginalRequest = new RecordedRequest(Substitute.For<IStumpsHttpRequest>(), ContentDecoderHandling.DecodeNotRequired),
                OriginalResponse = new RecordedResponse(Substitute.For<IStumpsHttpResponse>(), ContentDecoderHandling.DecodeNotRequired),
                Response = new RecordedResponse(Substitute.For<IStumpsHttpResponse>(), ContentDecoderHandling.DecodeNotRequired),
                StumpCategory = "ABC",
                StumpId = "abc",
                StumpName = "StumpName"
            };

            var instance = new StumpsServerInstance(Substitute.For<IServerFactory>(), _serverId, _dal);
            instance.CreateStump(contract);
            Assert.IsTrue(instance.StumpNameExists(contract.StumpName));
        }
All Usage Examples Of Stumps.Server.StumpsServerInstance::StumpNameExists