public void IsErroneousResponseGivesFalseIfStatusResponseAttributeIsNotSet() { // given var attributes = ResponseAttributes.WithUndefinedDefaults().Build(); var target = StatusResponse.CreateSuccessResponse( logger, attributes, StatusResponse.HttpOk, new Dictionary <string, List <string> >()); // when, then Assert.That(target.IsErroneousResponse, Is.False); }
public void MergeTakesCaptureFromMergeSourceIfSetInSource() { // given var capture = !ResponseAttributesDefaults.Undefined.IsCapture; var source = ResponseAttributes.WithUndefinedDefaults().WithCapture(capture).Build(); var target = ResponseAttributes.WithUndefinedDefaults().Build(); // when var obtained = target.Merge(source); // then Assert.That(obtained, Is.Not.Null); Assert.That(obtained.IsCapture, Is.EqualTo(capture)); }
public void MergeTakesVisitStoreVersionFromMergeSourceIfSetInSourceAndTarget() { // given const int visitStoreVersion = 73; var source = ResponseAttributes.WithUndefinedDefaults().WithVisitStoreVersion(visitStoreVersion).Build(); var target = ResponseAttributes.WithUndefinedDefaults().WithVisitStoreVersion(37).Build(); // when var obtained = target.Merge(source); // then Assert.That(obtained, Is.Not.Null); Assert.That(obtained.VisitStoreVersion, Is.EqualTo(visitStoreVersion)); }
public void MergeTakesEventsPerSessionFromMergeTargetIfNotSetInSource() { // given const int eventsPerSession = 73; var source = ResponseAttributes.WithUndefinedDefaults().Build(); var target = ResponseAttributes.WithUndefinedDefaults().WithMaxEventsPerSession(eventsPerSession).Build(); // when var obtained = target.Merge(source); // then Assert.That(obtained, Is.Not.Null); Assert.That(obtained.MaxEventsPerSession, Is.EqualTo(eventsPerSession)); }
public void MergeTakesBeaconSizeFromMergeSourceIfSetInSourceAndTarget() { // given const int beaconSize = 73; var source = ResponseAttributes.WithUndefinedDefaults().WithMaxBeaconSizeInBytes(beaconSize).Build(); var target = ResponseAttributes.WithUndefinedDefaults().WithMaxBeaconSizeInBytes(37).Build(); // when var obtained = target.Merge(source); // then Assert.That(obtained, Is.Not.Null); Assert.That(obtained.MaxBeaconSizeInBytes, Is.EqualTo(beaconSize)); }
public void MergeTakesTimestampFromMergeSourceIfSetInSourceAndTarget() { // given const long timestamp = 73; var source = ResponseAttributes.WithUndefinedDefaults().WithTimestampInMilliseconds(timestamp).Build(); var target = ResponseAttributes.WithUndefinedDefaults().WithTimestampInMilliseconds(37).Build(); // when var obtained = target.Merge(source); // then Assert.That(obtained, Is.Not.Null); Assert.That(obtained.TimestampInMilliseconds, Is.EqualTo(timestamp)); }
public void MergeTakesStatusFromMergeSourceIfSetInSourceAndTarget() { // given const string status = "status"; var source = ResponseAttributes.WithUndefinedDefaults().WithStatus(status).Build(); var target = ResponseAttributes.WithUndefinedDefaults().WithStatus("foobar").Build(); // when var obtained = target.Merge(source); // then Assert.That(obtained, Is.Not.Null); Assert.That(obtained.Status, Is.EqualTo(status)); }
public void MergeTakesServerIdFromMergeSourceIfSetInSourceAndTarget() { // given const int serverId = 73; var source = ResponseAttributes.WithUndefinedDefaults().WithServerId(serverId).Build(); var target = ResponseAttributes.WithUndefinedDefaults().WithServerId(37).Build(); // when var obtained = target.Merge(source); // then Assert.That(obtained, Is.Not.Null); Assert.That(obtained.ServerId, Is.EqualTo(serverId)); }
public void MergeTakesMultiplicityFromMergeSourceIfSetInSourceAndTarget() { // given const int multiplicity = 73; var source = ResponseAttributes.WithUndefinedDefaults().WithMultiplicity(multiplicity).Build(); var target = ResponseAttributes.WithUndefinedDefaults().WithMultiplicity(37).Build(); // when var obtained = target.Merge(source); // then Assert.That(obtained, Is.Not.Null); Assert.That(obtained.Multiplicity, Is.EqualTo(multiplicity)); }
public void MergeTakesApplicationIdFromMergeSourceIfSetInSourceAndTarget() { // given var applicationId = Guid.NewGuid().ToString(); var source = ResponseAttributes.WithUndefinedDefaults().WithApplicationId(applicationId).Build(); var target = ResponseAttributes.WithUndefinedDefaults().WithApplicationId(Guid.NewGuid().ToString()).Build(); // when var obtained = target.Merge(source); // then Assert.That(obtained, Is.Not.Null); Assert.That(obtained.ApplicationId, Is.EqualTo(applicationId)); }
public void MergeTakesSendIntervalFromMergeSourceIfSetInSource() { // given const int sendInterval = 73; var source = ResponseAttributes.WithUndefinedDefaults().WithSendIntervalInMilliseconds(sendInterval) .Build(); var target = ResponseAttributes.WithUndefinedDefaults().Build(); // when var obtained = target.Merge(source); // then Assert.That(obtained, Is.Not.Null); Assert.That(obtained.SendIntervalInMilliseconds, Is.EqualTo(sendInterval)); }
public void MergeTakesSessionTimeoutFromMergeSourceIfSetInSourceAndTarget() { // given const int sessionTimeout = 73; var source = ResponseAttributes.WithUndefinedDefaults().WithSessionTimeoutInMilliseconds(sessionTimeout) .Build(); var target = ResponseAttributes.WithUndefinedDefaults().WithSessionTimeoutInMilliseconds(37).Build(); // when var obtained = target.Merge(source); // then Assert.That(obtained, Is.Not.Null); Assert.That(obtained.SessionTimeoutInMilliseconds, Is.EqualTo(sessionTimeout)); }
public void MergingDefaultResponsesReturnsResponseWithoutAnyAttributeSet() { // given var toMerge = ResponseAttributes.WithUndefinedDefaults().Build(); var target = ResponseAttributes.WithJsonDefaults().Build(); // when var obtained = target.Merge(toMerge); // then foreach (var attribute in Enum.GetValues(typeof(ResponseAttribute)).Cast <ResponseAttribute>()) { Assert.That(obtained.IsAttributeSet(attribute), Is.False); } }
public void MergeResponseWithAllValuesSetToDefaultResponse() { // given var toMerge = Substitute.For <IResponseAttributes>(); toMerge.IsAttributeSet(Arg.Any <ResponseAttribute>()).Returns(true); var target = ResponseAttributes.WithUndefinedDefaults().Build(); // when var obtained = target.Merge(toMerge); // then foreach (var attribute in Enum.GetValues(typeof(ResponseAttribute)).Cast <ResponseAttribute>()) { Assert.That(obtained.IsAttributeSet(attribute), Is.True); } }