예제 #1
0
 private ProcessReport Verify(string measureCode, string name, decimal price, ProviderData dataOnServer, int?code, MeasureUnit measureUnit, DateTime timestamp)
 {
     data.Timestamp = timestamp;
     data.Products  = new[] { new ProductData()
                              {
                                  Id = new Guid(), MeasureUnitCode = measureCode, Name = name, Price = price
                              } };
     dataSerialized = JsonConvert.SerializeObject(data);
     A.CallTo(() => repository.FindByProviderId(A <Guid> .Ignored)).Returns(dataOnServer);
     A.CallTo(() => productsReference.FindCodeByName(A <string> .Ignored)).Returns(code);
     A.CallTo(() => measureUnitsReference.FindByCode(A <string> .Ignored)).Returns(measureUnit);
     return(new ProviderProcessor(productsReference, measureUnitsReference, repository).ProcessProviderData(dataSerialized));
 }
        public void SetUp()
        {
            productsReference = A.Fake <ProductsReference>();
            A.CallTo(() => productsReference.FindCodeByName("unknown")).Returns(null);
            A.CallTo(() => productsReference.FindCodeByName("known")).Returns(42);
            ProductsReference.SetInstance(productsReference);

            measureUnitsReference = A.Fake <MeasureUnitsReference>();
            A.CallTo(() => measureUnitsReference.FindByCode("unknown")).Returns(null);
            A.CallTo(() => measureUnitsReference.FindByCode("known")).Returns(new MeasureUnit());
            MeasureUnitsReference.SetInstance(measureUnitsReference);

            processor      = new ProviderProcessor(A.Fake <ProviderRepository>(), null);
            memoryAppender = new MemoryAppender();
            BasicConfigurator.Configure(memoryAppender);
        }
예제 #3
0
        public void SetUp()
        {
            data           = new ProviderData();
            data.Products  = new ProductData[0];
            dataSerialized = JsonConvert.SerializeObject(data);
            repository     = A.Fake <IProviderRepository>();
            A.CallTo(() => repository.FindByProviderId(A <Guid> .Ignored)).Returns(null);
            A.CallTo(() => repository.RemoveById(A <Guid> .Ignored)).DoesNothing();
            A.CallTo(() => repository.Save(A <ProviderData> .Ignored)).DoesNothing();
            A.CallTo(() => repository.Update(A <ProviderData> .Ignored)).DoesNothing();

            productsReference = A.Fake <ProductsReference>();
            A.CallTo(() => productsReference.FindCodeByName(A <string> .Ignored)).Returns(null);

            measureUnitsReference = A.Fake <MeasureUnitsReference>();
            A.CallTo(() => measureUnitsReference.FindByCode(A <string> .Ignored)).Returns(null);
        }
예제 #4
0
 private bool IsValidMeasureUnitCode(string measureUnitCode)
 {
     return(measureUnitsReference.FindByCode(measureUnitCode) != null);
 }