Exemple #1
0
        public async void CreateProducerList_WithSchemaVersion306_SetsSchemaVersion()
        {
            // Arrange
            var dataAccess = A.Fake <IProducerListFactoryDataAccess>();

            A.CallTo(() => dataAccess.FetchSchemeInfo(A <Guid> ._)).Returns(new List <SchemeInfo>
            {
                new SchemeInfo {
                    ApprovalNumber = "123", TradingName = "Test"
                }
            });

            ProducerListFactory producerListFactory = new ProducerListFactory(dataAccess);

            ProducerListSettings listSettings = new ProducerListSettings()
            {
                OrganisationID = new Guid("20C569E6-C4A0-40C2-9D87-120906D5434B"),
                SchemaVersion  = MemberRegistrationSchemaVersion.Version_3_06
            };

            // Act
            ProducerList producerList = await producerListFactory.CreateAsync(listSettings);

            // Assert
            Assert.Equal(MemberRegistrationSchemaVersion.Version_3_06, producerList.SchemaVersion);
        }
Exemple #2
0
        public async void CreateProducerList_With1NewProducer_And1ExistingProducer_Creates2Producers()
        {
            // Arrange
            var dataAccess = A.Fake <IProducerListFactoryDataAccess>();

            A.CallTo(() => dataAccess.FetchSchemeInfo(A <Guid> ._)).Returns(new List <SchemeInfo>
            {
                new SchemeInfo {
                    ApprovalNumber = "123", TradingName = "Test"
                }
            });
            A.CallTo(() => dataAccess.GetRegistrationNumbers(A <Guid> ._, A <int> ._, A <int> ._)).Returns(
                new List <string>
            {
                "1"
            });

            ProducerListFactory producerListFactory = new ProducerListFactory(dataAccess);

            ProducerListSettings listSettings = new ProducerListSettings()
            {
                OrganisationID            = new Guid("20C569E6-C4A0-40C2-9D87-120906D5434B"),
                NumberOfNewProducers      = 1,
                NumberOfExistingProducers = 1,
                ComplianceYear            = 2015
            };

            // Act
            ProducerList producerList = await producerListFactory.CreateAsync(listSettings);

            // Assert
            Assert.Equal(2, producerList.Producers.Count);
        }
Exemple #3
0
        public async void CreateProducerList_WithComplianceYear2015_SetsComplianceYear()
        {
            // Arrange
            var dataAccess = A.Fake <IProducerListFactoryDataAccess>();

            A.CallTo(() => dataAccess.FetchSchemeInfo(A <Guid> ._)).Returns(new List <SchemeInfo>
            {
                new SchemeInfo {
                    ApprovalNumber = "123", TradingName = "Test"
                }
            });

            ProducerListFactory producerListFactory = new ProducerListFactory(dataAccess);

            ProducerListSettings listSettings = new ProducerListSettings()
            {
                OrganisationID = new Guid("20C569E6-C4A0-40C2-9D87-120906D5434B"),
                ComplianceYear = 2015
            };

            // Act
            ProducerList producerList = await producerListFactory.CreateAsync(listSettings);

            // Assert
            Assert.Equal(2015, producerList.ComplianceYear);
        }
        public async void CreateProducerList_WithUnknownOrganisation_ThrowsArgumentException()
        {
            // Arrange
            var dataAccess = A.Fake<IProducerListFactoryDataAccess>();
            A.CallTo(() => dataAccess.FetchSchemeInfo(A<Guid>._)).Returns(new List<SchemeInfo>());

            ProducerListFactory producerListFactory = new ProducerListFactory(dataAccess);

            // Act
            Func<Task<ProducerList>> action = () => producerListFactory.CreateAsync(new ProducerListSettings());

            // Assert
            await Assert.ThrowsAsync(typeof(ArgumentException), action);
        }
Exemple #5
0
        public async void CreateProducerList_WithUnknownOrganisation_ThrowsArgumentException()
        {
            // Arrange
            var dataAccess = A.Fake <IProducerListFactoryDataAccess>();

            A.CallTo(() => dataAccess.FetchSchemeInfo(A <Guid> ._)).Returns(new List <SchemeInfo>());

            ProducerListFactory producerListFactory = new ProducerListFactory(dataAccess);

            // Act
            Func <Task <ProducerList> > action = () => producerListFactory.CreateAsync(new ProducerListSettings());

            // Assert
            await Assert.ThrowsAsync(typeof(ArgumentException), action);
        }
        public async void CreateProducerList_WithComplianceYear2015_SetsComplianceYear()
        {
            // Arrange
            var dataAccess = A.Fake<IProducerListFactoryDataAccess>();
            A.CallTo(() => dataAccess.FetchSchemeInfo(A<Guid>._)).Returns(new List<SchemeInfo>
            {
                new SchemeInfo { ApprovalNumber = "123", TradingName = "Test" }
            });

            ProducerListFactory producerListFactory = new ProducerListFactory(dataAccess);

            ProducerListSettings listSettings = new ProducerListSettings()
            {
                OrganisationID = new Guid("20C569E6-C4A0-40C2-9D87-120906D5434B"),
                ComplianceYear = 2015
            };

            // Act
            ProducerList producerList = await producerListFactory.CreateAsync(listSettings);

            // Assert
            Assert.Equal(2015, producerList.ComplianceYear);
        }
        public async void CreateProducerList_WithSchemaVersion306_SetsSchemaVersion()
        {
            // Arrange
            var dataAccess = A.Fake<IProducerListFactoryDataAccess>();
            A.CallTo(() => dataAccess.FetchSchemeInfo(A<Guid>._)).Returns(new List<SchemeInfo>
            {
                new SchemeInfo { ApprovalNumber = "123", TradingName = "Test" }
            });

            ProducerListFactory producerListFactory = new ProducerListFactory(dataAccess);

            ProducerListSettings listSettings = new ProducerListSettings()
            {
                OrganisationID = new Guid("20C569E6-C4A0-40C2-9D87-120906D5434B"),
                SchemaVersion = MemberRegistrationSchemaVersion.Version_3_06
            };

            // Act
            ProducerList producerList = await producerListFactory.CreateAsync(listSettings);

            // Assert
            Assert.Equal(MemberRegistrationSchemaVersion.Version_3_06, producerList.SchemaVersion);
        }
        public async void CreateProducerList_With1NewProducer_And1ExistingProducer_Creates2Producers()
        {
            // Arrange
            var dataAccess = A.Fake<IProducerListFactoryDataAccess>();
            A.CallTo(() => dataAccess.FetchSchemeInfo(A<Guid>._)).Returns(new List<SchemeInfo>
            {
                new SchemeInfo { ApprovalNumber = "123", TradingName = "Test" }
            });
            A.CallTo(() => dataAccess.GetRegistrationNumbers(A<Guid>._, A<int>._, A<int>._)).Returns(
                new List<string>
                {
                    "1"
                });

            ProducerListFactory producerListFactory = new ProducerListFactory(dataAccess);

            ProducerListSettings listSettings = new ProducerListSettings()
            {
                OrganisationID = new Guid("20C569E6-C4A0-40C2-9D87-120906D5434B"),
                NumberOfNewProducers = 1,
                NumberOfExistingProducers = 1,
                ComplianceYear = 2015
            };

            // Act
            ProducerList producerList = await producerListFactory.CreateAsync(listSettings);

            // Assert
            Assert.Equal(2, producerList.Producers.Count);
        }