Пример #1
0
        public async void ProcessXmlfile_StoresProcessTime()
        {
            IEnumerable <MemberUploadError> errors = new List <MemberUploadError>();

            A.CallTo(() => xmlValidator.Validate(Message))
            .Returns(errors);

            MemberUpload upload = A.Fake <MemberUpload>();

            A.CallTo(() => generator.GenerateMemberUpload(
                         Message,
                         errors as List <MemberUploadError>,
                         0,
                         A.Dummy <Scheme>(), false))
            .WithAnyArguments()
            .Returns(upload);

            SetupSchemeTypeComplianceYear();

            await handler.HandleAsync(Message);

            A.CallTo(() => upload.SetProcessTime(new TimeSpan()))
            .WithAnyArguments()
            .MustHaveHappened(Repeated.Exactly.Once);
        }
Пример #2
0
        public void SetProcessTime_WhenCurrentValueIsNotZero_ThrowInvalidOperationException()
        {
            // Arrange
            var memberUpload = new MemberUpload(
                A.Dummy <Guid>(),
                A.Dummy <string>(),
                A.Dummy <List <MemberUploadError> >(),
                A.Dummy <int>(),
                A.Dummy <int>(),
                A.Dummy <Scheme>(),
                A.Dummy <string>());

            memberUpload.SetProcessTime(TimeSpan.FromSeconds(15));

            // Act
            Action action = () => memberUpload.SetProcessTime(TimeSpan.FromSeconds(25));

            // Assert
            Assert.Throws <InvalidOperationException>(action);
        }
Пример #3
0
        public void SetProcessTime_WhenCurrentValueIsZero_SetProcessTime()
        {
            // Arrange
            var memberUpload = new MemberUpload(
                A.Dummy <Guid>(),
                A.Dummy <string>(),
                A.Dummy <List <MemberUploadError> >(),
                A.Dummy <int>(),
                A.Dummy <int>(),
                A.Dummy <Scheme>(),
                A.Dummy <string>());

            // Act
            memberUpload.SetProcessTime(TimeSpan.FromSeconds(15));

            // Assert
            Assert.Equal(TimeSpan.FromSeconds(15), memberUpload.ProcessTime);
        }
        public void SetProcessTime_WhenCurrentValueIsNotZero_ThrowInvalidOperationException()
        {
            // Arrange
            var memberUpload = new MemberUpload(
                A.Dummy<Guid>(),
                A.Dummy<string>(),
                A.Dummy<List<MemberUploadError>>(),
                A.Dummy<int>(),
                A.Dummy<int>(),
                A.Dummy<Scheme>(),
                A.Dummy<string>());

            memberUpload.SetProcessTime(TimeSpan.FromSeconds(15));

            // Act
            Action action = () => memberUpload.SetProcessTime(TimeSpan.FromSeconds(25));

            // Assert
            Assert.Throws<InvalidOperationException>(action);
        }
        public void SetProcessTime_WhenCurrentValueIsZero_SetProcessTime()
        {
            // Arrange
            var memberUpload = new MemberUpload(
                A.Dummy<Guid>(),
                A.Dummy<string>(),
                A.Dummy<List<MemberUploadError>>(),
                A.Dummy<int>(),
                A.Dummy<int>(),
                A.Dummy<Scheme>(),
                A.Dummy<string>());

            // Act
            memberUpload.SetProcessTime(TimeSpan.FromSeconds(15));

            // Assert
            Assert.Equal(TimeSpan.FromSeconds(15), memberUpload.ProcessTime);
        }