Beispiel #1
0
 public ProductSkuInfo(ProductId aProductId, SpecificationId aSpecificationId, Money aUnitPrice, PictureId aPictureId)
 {
     ProductId       = aProductId;
     SpecificationId = aSpecificationId;
     UnitPrice       = aUnitPrice;
     PictureId       = aPictureId;
 }
Beispiel #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (SpecificationId != null ? SpecificationId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ PercentageCompleted;
         hashCode = (hashCode * 397) ^ (int)CalculationProgress;
         hashCode = (hashCode * 397) ^ (ErrorMessage != null ? ErrorMessage.GetHashCode() : 0);
         return(hashCode);
     }
 }
        public override int GetHashCode()
        {
            var hashCode = -132621161;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(CatalogName);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(CatalogId);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ProductName);

            hashCode = hashCode * -1521134295 + EqualityComparer <Uri> .Default.GetHashCode(ProductPicture);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(SpecificationName);

            hashCode = hashCode * -1521134295 + SpecificationId.GetHashCode();
            hashCode = hashCode * -1521134295 + Price.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Property);

            return(hashCode);
        }
Beispiel #4
0
        public async Task OnNotificationEvent_WhenParentJobWithSpecificationIdIsCreated_ThenSignalRMessagesAdded()
        {
            // Arrange
            NotificationService service = CreateService();

            JobSummary jobNotification = new JobSummary()
            {
                CompletionStatus = null,
                JobId            = JobId,
                JobType          = "test",
                SpecificationId  = SpecificationId,
            };

            string json = JsonConvert.SerializeObject(jobNotification);

            Message message = new Message(Encoding.UTF8.GetBytes(json));

            IAsyncCollector <SignalRMessage> generatedMessages = CreateSignalRMessageCollector();

            // Act
            await service.OnNotificationEvent(message, generatedMessages);

            // Assert
            await generatedMessages
            .Received(3)
            .AddAsync(Arg.Any <SignalRMessage>());

            await generatedMessages
            .Received(1)
            .AddAsync(
                Arg.Is <SignalRMessage>(
                    c => c.Target == JobConstants.NotificationsTargetFunction &&
                    c.Arguments.Length == 1 &&
                    c.Arguments.First() != null &&
                    c.GroupName == JobConstants.NotificationChannels.All));

            await generatedMessages
            .Received(1)
            .AddAsync(
                Arg.Is <SignalRMessage>(
                    c => c.Target == JobConstants.NotificationsTargetFunction &&
                    c.Arguments.Length == 1 &&
                    c.Arguments.First() != null &&
                    c.GroupName == JobConstants.NotificationChannels.ParentJobs));

            await generatedMessages
            .Received(1)
            .AddAsync(
                Arg.Is <SignalRMessage>(
                    c => c.Target == JobConstants.NotificationsTargetFunction &&
                    c.Arguments.Length == 1 &&
                    c.Arguments.First() != null &&
                    c.GroupName == $"{JobConstants.NotificationChannels.SpecificationPrefix}{SpecificationId.Replace("-", "")}"));
        }