Example #1
0
        public void Should_assertions()
        {
            object obj = null;
            obj.ShouldBeNull();

            obj = new object();
            obj.ShouldBeType(typeof(object));
            obj.ShouldEqual(obj);
            obj.ShouldNotBeNull();
            obj.ShouldNotBeSameAs(new object());
            obj.ShouldNotBeType(typeof(string));
            obj.ShouldNotEqual("foo");

            obj = "x";
            obj.ShouldNotBeInRange("y", "z");
            obj.ShouldBeInRange("a", "z");
            obj.ShouldBeSameAs("x");

            "This String".ShouldContain("This");
            "This String".ShouldNotBeEmpty();
            "This String".ShouldNotContain("foobar");

            false.ShouldBeFalse();
            true.ShouldBeTrue();

            var list = new List<object>();
            list.ShouldBeEmpty();
            list.ShouldNotContain(new object());

            var item = new object();
            list.Add(item);
            list.ShouldNotBeEmpty();
            list.ShouldContain(item);
        }
Example #2
0
        public void ModelFactory_ConvertFrom_SettlementModelList_ListIsEmpty_ModelConverted()
        {
            ModelFactory              factory            = new ModelFactory();
            List <SettlementModel>    settlementModeList = new List <SettlementModel>();
            List <SettlementResponse> response           = factory.ConvertFrom(settlementModeList);

            response.ShouldNotBeNull();
            response.ShouldBeEmpty();
        }
 public void ShouldBeEmpty()
 {
     DocExampleWriter.Document(() =>
     {
         var homer = new Person() { Name = "Homer" };
         var powerPlantOnTheWeekend = new List<Person>() { homer };
         powerPlantOnTheWeekend.ShouldBeEmpty();
     }, _testOutputHelper);
 }
Example #4
0
        public void ModelFactory_ConvertFrom_SettlementFeeModelList_ListIsNull_ModelConverted()
        {
            ModelFactory factory = new ModelFactory();
            List <SettlementFeeModel>    modelList = null;
            List <SettlementFeeResponse> response  = factory.ConvertFrom(modelList);

            response.ShouldNotBeNull();
            response.ShouldBeEmpty();
        }
Example #5
0
        public void TestGetPendingApprovals_NoPendingApprovals()
        {
            // assemble

            // act
            List <ApprovalViewModel> pendingApprovals = Facade.GetPendingApprovals();

            // assert
            pendingApprovals.ShouldBeEmpty();
        }
Example #6
0
        public void Advanced_presciption_not_found()
        {
            var stubRepository                = CreateStubRepository();
            PrescriptionAdvancedDTO   dto     = CreateFalseDTO();
            PrescriptionSearchService service = new PrescriptionSearchService(stubRepository, CreateUserGateway());

            List <Prescription> prescriptions = service.AdvancedSearchPrescriptions(dto);

            prescriptions.ShouldBeEmpty();
        }
        public void ModelFactory_ConvertFrom_FileImportLog_NoImportLogs_IsConverted()
        {
            IModelFactory modelFactory = new ModelFactory();
            List <EstateReporting.Database.Entities.FileImportLog> fileImportLogs = new List <EstateReporting.Database.Entities.FileImportLog>();
            List <FileImportLogFile> files  = new List <FileImportLogFile>();
            List <FileImportLog>     result = modelFactory.ConvertFrom(fileImportLogs, files);

            result.ShouldNotBeNull();
            result.ShouldBeEmpty();
        }
Example #8
0
        public void LoadHeadingDropDownListHelper_QuickNotHaveNavigationNodesValidAppId_Populates()
        {
            // Arrange
            ArrangeLoadHeadingDropDownListHelper(QuickLaunchType, false, 1, false);

            // Act
            _privateObject.Invoke(LoadHeadingDropDownListMethodName);

            // Assert
            this.ShouldSatisfyAllConditions(
                () => _navigationIds.ShouldBeEmpty(),
                () =>
            {
                var item = _items[0];
                item.Text.ShouldBe(DummyNodeTitle);
                item.Value.ShouldBe(DummyNavigationNodeID.ToString());
            },
                () => _actualSelectedValue.ShouldBe(DummyParentId.ToString()));
        }
        public void it_ignores_new_files_that_were_added_and_removed_within_grace_period()
        {
            AppendToFile("file1", "Test");
            Thread.Sleep(2);

            File.Delete(Path.Combine(TestHelper.WatchRoot, "file1"));
            Thread.Sleep(_monitor.GracePeriod * 2);

            _changedFiles.ShouldBeEmpty();
        }
Example #10
0
        public void all_discarded_items_are_notified()
        {
            var selected  = new List <int>();
            var discarded = new List <int>();
            var source    = new[] { 1, 2, 3 };
            var result    = source.AsObservable(x => x.Where(i => false), selected.Add, discarded.Add).ToList();

            selected.ShouldBeEmpty();

            discarded.ShouldBe(new[] { 1, 2, 3 });
        }
        public void Execute_InitiJobFalse_NoActionTaken()
        {
            // Arrange
            var executedCommands = new List <string>();
            var site             = new ShimSPSite
            {
                WebApplicationGet = () => new ShimSPWebApplication(),
                RootWebGet        = () => new ShimSPWeb
                {
                    RegionalSettingsGet = () => new ShimSPRegionalSettings
                    {
                        WorkDayStartHourGet = () => 1,
                        WorkDayEndHourGet   = () => 2,
                        WorkDaysGet         = () => 2
                    }
                },
                AllWebsGet = () =>
                {
                    var list = new List <SPWeb>
                    {
                        new ShimSPWeb()
                    }.AsEnumerable();
                    return(new ShimSPWebCollection().Bind(list));
                }
            };
            var web = new ShimSPWeb();

            ShimBaseJob.AllInstances.initJobSPSite = (_, spSite) => false;
            ShimTimerFix.AllInstances.processWebSPWebStringSingleRef           = ProcessWeb;
            ShimTimerFix.AllInstances.processResPlanSPWebStringGuidInt32String =
                (_, spWeb, lists, id, hours, days) => { };
            ShimSPWebCollection.AllInstances.CountGet = _ => 1;

            ShimSqlCommand.AllInstances.ExecuteNonQuery = command =>
            {
                executedCommands.Add(command.CommandText);
                return(1);
            };
            ShimSqlCommand.AllInstances.ExecuteReader = command =>
            {
                executedCommands.Add(command.CommandText);
                return(new ShimSqlDataReader
                {
                    Read = () => true,
                    GetGuidInt32 = index => Guid.NewGuid()
                });
            };

            // Act
            timerFix.execute(site, web, string.Empty);

            // Assert
            executedCommands.ShouldBeEmpty();
        }
        public void Map_object_search_for_non_existing_object()
        {
            var mapObjects         = CreateMapObjectList();
            var searchedMapObjects = new List <MapObject>();

            MapObjectService mapObjectService = new MapObjectService(createStubRepository());

            searchedMapObjects = mapObjectService.SearchMapObjects("", "Canteen");

            searchedMapObjects.ShouldBeEmpty();
        }
Example #13
0
        public void Advanced_report_not_found()
        {
            var stubRepository    = CreateStubRepository();
            ReportAdvancedDTO dto = CreateFalseDTO();

            ReportSearchService service = new ReportSearchService(stubRepository, CreateUserGateway());

            List <Report> reports = service.AdvancedSearchReports(dto);

            reports.ShouldBeEmpty();
        }
 public void ICollection_ShouldBeEmptyFailTest()
 {
     Assert.ThrowsException <AssertFailedException>(() =>
     {
         var source = new List <int>()
         {
             1
         };
         source.ShouldBeEmpty();
     });
 }
Example #15
0
        public void Get_NoUsersExists_ReturnsEmptyList()
        {
            // Arrange
            _getUsersViewMock
            .Load()
            .Returns(new GetUsersView());

            // Act
            List <UserProfile> userProfiles = _userController.Get();

            // Assert
            userProfiles.ShouldBeEmpty();
        }
 public void ShouldBeEmpty()
 {
     DocExampleWriter.Document(() =>
     {
         var homer = new Person {
             Name = "Homer"
         };
         var powerPlantOnTheWeekend = new List <Person> {
             homer
         };
         powerPlantOnTheWeekend.ShouldBeEmpty();
     }, _testOutputHelper);
 }
Example #17
0
        public void Recommend_by_doctor_priority_fail()
        {
            var surveyRepository      = CreateSurveyStubRepository();
            var userGateway           = CreateUserGateway();
            var roomGateway           = CreateRoomGateway();
            var appointmentRepository = CreateAppointmentStubRepository();
            var priorityParameters    = CreatePriorityParametersForDoctorPriorityFail();

            AppointmentService appointmentService = new AppointmentService(appointmentRepository, userGateway, roomGateway, surveyRepository);

            List <Appointment.Domain.Entities.Appointment> recommendedAppointments = appointmentService.GetAvailableByStrategy(priorityParameters);

            recommendedAppointments.ShouldBeEmpty();
        }
Example #18
0
        public void Find_No_Prescriptions_AND()
        {
            PrescriptionService service = new PrescriptionService(CreateStubRepository());

            List <Prescription> foundPrescriptions = service.AdvancedSearchPrescriptions(new PrescriptionAdvancedSearchDto("medicines", "Medicine Name", new string[1] {
                "comment"
            }, new string[1] {
                "Comment23"
            }, new string[1] {
                "and"
            }));

            foundPrescriptions.ShouldBeEmpty();
        }
Example #19
0
        public void RequiredFieldsAllValuesSupplied()
        {
            BodyWithRequiredFields body = new BodyWithRequiredFields()
            {
                Param1 = "value1",
                Param2 = "value2"
            };

            List <ValidationResult> validationResults = new List <ValidationResult>();
            var result = RecursiveValidator.TryValidateObject(body, validationResults, true);

            result.ShouldBeTrue();
            validationResults.ShouldBeEmpty();
        }
        public void Find_No_Appointments_AND()
        {
            RegularAppointmentService service = new RegularAppointmentService(CreateStubRepository(), new Mock <IEmployeesScheduleRepository>().Object, new DoctorService(new Mock <IOperationRepository>().Object, CreateStubRepository(), new Mock <IEmployeesScheduleRepository>().Object, new Mock <IDoctorRepository>().Object), new Mock <IPatientsRepository>().Object, new OperationService(new Mock <IOperationRepository>().Object));

            List <DoctorAppointment> foundAppointments = service.AdvancedSearchAppointments(new AppointmentAdvancedSearchDto("date", "22/04/2020", new string[1] {
                "date"
            }, new string[1] {
                "Date12"
            }, new string[1] {
                "and"
            }));

            foundAppointments.ShouldBeEmpty();
        }
        public void ShouldNotWriteIntegration()
        {
            // Arrange
            var vars = new TestableVersionVariables("1.0.0");

            var list = new List <string>();

            // Assert
            environment.GetEnvironmentVariable("GitVersion_Major").ShouldBeNullOrWhiteSpace();

            // Act
            buildServer.WriteIntegration(s => { list.Add(s); }, vars, false);

            list.ShouldBeEmpty();
        }
    public void CanUpdateProjectFileWithSdkProjectFileXml(string sdk)
    {
        var xml       = $@"
<Project Sdk=""{sdk}"">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>
</Project>
";
        var canUpdate = projectFileUpdater.CanUpdateProjectFile(XElement.Parse(xml));

        canUpdate.ShouldBe(true);
        logMessages.ShouldBeEmpty();
    }
        public void Should_pass_for_empty_config(string xmlRules)
        {
            var newConfigFileContent = string.Empty;
            Action <string, byte[]> saveConfigFileAction = (s, bytes) =>
            {
                newConfigFileContent = Encoding.UTF8.GetString(bytes);
            };
            var instance = CreateInstance(saveConfigFileAction);
            var errors   = new List <string>();

            instance.ParseConfigString("SolutionCop.xml", xmlRules, new IProjectRule[] { new DummyRule() }, errors, false);
            errors.ShouldBeEmpty();
            newConfigFileContent.ShouldNotBeEmpty();
            Approvals.Verify(newConfigFileContent);
        }
Example #24
0
        public void SaveScheduleReport_WhenScheduleFtpReportListAndscheduleFtpExportTrue_Test()
        {
            // Arrange
            SetUpFakesForSaveScheduleReportMethod(blastReportId: OtherReportId);
            SetWizardSchedulePageProperties();
            var newBlastList = new List <BlastAbstract> {
                new BlastChampion {
                    BlastID = 1
                }
            };
            var campaignItemId = 1;

            _testEntity.scheduleFtpExport = true;

            // Act
            _privateTestObject.Invoke(SaveScheduleReportMethodName, newBlastList);

            // Assert
            _isReportQueueCleared.ShouldBeTrue();
            _isReportScheduleDeleted.ShouldBeFalse();
            _deletedReportQueueId.ShouldSatisfyAllConditions(
                () => _deletedReportQueueId.ShouldNotBeEmpty(),
                () => _deletedReportQueueId.Count.ShouldBe(1),
                () => _deletedReportQueueId.ShouldContain(FtpReportId));
            _deletedReportScheduleId.ShouldSatisfyAllConditions(
                () => _deletedReportScheduleId.ShouldBeEmpty());
            _savedReportSchedule.ShouldNotBeNull();
            _savedReportSchedule.ShouldSatisfyAllConditions(
                () => _savedReportSchedule.ReportScheduleID.ShouldBe(FtpReportId),
                () => _savedReportSchedule.StartTime.ShouldBe(ReportTime),
                () => _savedReportSchedule.StartDate.ShouldContain(DateTime.UtcNow.ToString("MM/dd/yyyy")),
                () => _savedReportSchedule.FromEmail.ShouldBe(FromEmail),
                () => _savedReportSchedule.ToEmail.ShouldBe(ToEmail),
                () => _savedReportSchedule.ReportID.ShouldBe(1),
                () => _savedReportSchedule.ReportParameters.ShouldContain(CcList));
        }
Example #25
0
        protected static void AssertAreImmutable(IEnumerable <Type> types)
        {
            var results = new List <Type>();

            foreach (var type in types)
            {
                if (type.GetFields().Any(x => !x.IsInitOnly) || type.GetProperties(BindingFlags.Public).Any(x => x.CanWrite))
                {
                    results.Add(type);
                    break;
                }
            }

            results.ShouldBeEmpty();
        }
Example #26
0
        public void DeserializeInvoice()
        {
            var jObj    = TestUtils.LoadJsonFromFile <JObject>(GetScrapedFolder(), "2019-08-06_SUEZ Recycling _5394744_08-26_2.json");
            var errors  = new List <string>();
            var invoice = JsonConvert.DeserializeObject <InvoiceFull>(jObj.ToString(), new JsonSerializerSettings
            {
                Error = delegate(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs args)
                {
                    errors.Add($"{args.ErrorContext.Path}: {args.ErrorContext.Error.Message}");
                    args.ErrorContext.Handled = true;
                },
            });

            errors.ShouldBeEmpty();
        }
Example #27
0
        public void TestTargetNames()
        {
            var expected = new List <string>()
            {
                "dummy-target",
                "cloud-foundry",
                "docker"
            };

            foreach (var name in Registry.Targets)
            {
                expected.ShouldContain(name);
                expected.Remove(name);
            }

            expected.ShouldBeEmpty();
        }
Example #28
0
 public virtual void TestGetAll()
 {
     using (var iocContainer = GetIocContainer())
     {
         var simples = new List <ISimple>();
         for (int i = 0; i < 10; i++)
         {
             simples.Add(new Simple());
             iocContainer.BindToConstant(simples[i]);
         }
         var items = iocContainer.GetAll <ISimple>();
         foreach (var simple in items)
         {
             simples.Remove(simple);
         }
         simples.ShouldBeEmpty();
     }
 }
Example #29
0
        public void Datenspeicher_gibt_0_Datensaetze_zurueck_Erwarte_leere_Liste_und_protokolliere_Meldung()
        {
            // Arrange
            _mockKundenDatenspeicher
            .Setup(expression: m => m.SucheKunden(It.IsAny <string>()))
            .Returns(value: new List <Kunde>());

            // Act
            List <Kunde> actual = _systemUnderTest.SucheKunden(filter: null);

            // Assert
            actual.ShouldNotBeNull();
            actual.ShouldBeEmpty();

            _mockProtokollierer.Verify(
                expression: v => v.ProtokolliereInformation("Keine Kunden gefunden"),
                times: Times.Once);
        }
Example #30
0
        public void SucheKunden_Fehler_aufgetreten_Erwarte_leere_Liste_und_Fehlerprotokoll()
        {
            // Arrange
            _mockKundenDatenspeicher
            .Setup(expression: m => m.SucheKunden(It.IsAny <string>()))
            .Throws <Exception>();

            // Act
            List <Kunde> actual = _systemUnderTest.SucheKunden(filter: null);

            // Assert
            actual.ShouldNotBeNull();
            actual.ShouldBeEmpty();

            _mockProtokollierer.Verify(
                expression: v => v.ProtokolliereFehler("Es ist ein Fehler aufgetreten"),
                times: Times.Once);
        }
        public void Should_pass_for_config_with_valid_section()
        {
            const string            xmlRules             = @"
<Rules xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='SolutionCop.xsd'>
  <Dummy />
</Rules>";
            var                     newConfigFileContent = string.Empty;
            Action <string, byte[]> saveConfigFileAction = (s, bytes) =>
            {
                newConfigFileContent = Encoding.UTF8.GetString(bytes);
            };
            var instance = CreateInstance(saveConfigFileAction);
            var errors   = new List <string>();

            instance.ParseConfigString("SolutionCop.xml", xmlRules, new IProjectRule[] { new DummyRule() }, errors, false);
            errors.ShouldBeEmpty();
            newConfigFileContent.ShouldBeEmpty();
        }
Example #32
0
        public virtual void Domain_Entity_Or_AggregateRoot_Cannot_Have_Reference_To_Other_AggregateRoot() // use a reference id instead https://www.informit.com/articles/article.aspx?p=2020371&seqNum=4
        {
            var entityTypes = Types.InNamespace(this.baseNamespace)
                              .That()
                              .Inherit(typeof(Entity <>))
                              .And()
                              .DoNotInherit(typeof(Command <>)).GetTypes(); // ???? somehow Commands are selected as Entities
                                                                            //.And()
                                                                            //.DoNotInherit(typeof(AggregateRoot<>)).GetTypes();

            var aggregateRoots = Types.InNamespace(this.baseNamespace)
                                 .That()
                                 .Inherit(typeof(AggregateRoot <>)).GetTypes().ToList();

            const BindingFlags bindingFlags = BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Instance;
            var results = new List <Type>();

            foreach (var type in entityTypes)
            {
                var fields = type.GetFields(bindingFlags);
                foreach (var field in fields)
                {
                    if (aggregateRoots.Contains(field.FieldType) ||
                        field.FieldType.GenericTypeArguments.Any(x => aggregateRoots.Contains(x)))
                    {
                        results.Add(type);
                        break;
                    }
                }

                var properties = type.GetProperties(bindingFlags);
                foreach (var property in properties)
                {
                    if (aggregateRoots.Contains(property.PropertyType) ||
                        property.PropertyType.GenericTypeArguments.Any(x => aggregateRoots.Contains(x)))
                    {
                        results.Add(type);
                        break;
                    }
                }
            }

            results.ShouldBeEmpty();
        }
 public void Should_pass_for_config_with_unknown_section()
 {
     const string xmlRules = @"
     <Rules>
       <NonExistingId />
       <Dummy />
     </Rules>
     ";
     var newConfigFileContent = string.Empty;
     Action<string, byte[]> saveConfigFileAction = (s, bytes) =>
     {
         newConfigFileContent = Encoding.UTF8.GetString(bytes);
     };
     var instance = CreateInstance(saveConfigFileAction);
     var errors = new List<string>();
     instance.Parse("SolutionCop.xml", xmlRules, new IProjectRule[] { new DummyRule() }, errors);
     errors.ShouldBeEmpty();
     newConfigFileContent.ShouldBeEmpty();
 }
 public void Should_pass_for_empty_config()
 {
     const string xmlRules = @"<Rules></Rules>";
     var newConfigFileContent = string.Empty;
     Action<string, byte[]> saveConfigFileAction = (s, bytes) =>
     {
         newConfigFileContent = Encoding.UTF8.GetString(bytes);
     };
     var instance = CreateInstance(saveConfigFileAction);
     var errors = new List<string>();
     instance.Parse("SolutionCop.xml", xmlRules, new IProjectRule[] { new DummyRule() }, errors);
     errors.ShouldBeEmpty();
     newConfigFileContent.ShouldNotBeEmpty();
     Approvals.Verify(newConfigFileContent);
 }